Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Feature request: Support for per-user database(s) #50

Copy link
Copy link

Description

@threepointone
Issue body actions

This is probably a subset of #31, but I'm making a fresh issue because maaaybe it's a simple enough subset that I'll be able to do it myself.

I'm building a Todo app. Every user gets their own Todo list (in their own Todo Durable Object, backed by their own DO sqlite database).

As an admin, only I will be able to use the studio to look into every user's database.

All database access will via bindings inside the Worker, there won't be any http access (except I suppose by the studio?)

What's the least number of modifications I'd have to make to make this work for me? Correct me if I'm wrong)

  • I'd have to read a database id dynamically (probably via cookie that I've authed the user on the app) and pass it here
    const id: DurableObjectId = env.DATABASE_DURABLE_OBJECT.idFromName(DURABLE_OBJECT_ID);
  • I could pass the user id into the url for /studio/userId, and add it as a header to every request made here
    "Authorization": "Bearer ${apiToken}"

But every user's database must have the same schema too. How do you suggest I go about that, should I manually create tables here?

What do you think I'm missing? happy to do some legwork here. Super impressed with this, and would love it to become my daily driver for my projects.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.