{"id":21332541,"url":"https://github.com/notrab/turso-per-user-starter","last_synced_at":"2025-04-06T07:09:53.247Z","repository":{"id":236792658,"uuid":"793161649","full_name":"notrab/turso-per-user-starter","owner":"notrab","description":"Database per user","archived":false,"fork":false,"pushed_at":"2025-03-25T23:58:33.000Z","size":2583,"stargazers_count":103,"open_issues_count":3,"forks_count":13,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-30T06:03:50.554Z","etag":null,"topics":["multitenancy","nextjs","sqlite","turso"],"latest_commit_sha":null,"homepage":"https://turso-per-user-starter.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/notrab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-28T15:49:36.000Z","updated_at":"2025-03-22T19:35:17.000Z","dependencies_parsed_at":"2024-04-28T16:44:51.392Z","dependency_job_id":"3fe676d7-c108-4773-af54-9e21873200c8","html_url":"https://github.com/notrab/turso-per-user-starter","commit_stats":null,"previous_names":["notrab/turso-platforms-starter","notrab/turso-per-user-starter"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notrab%2Fturso-per-user-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notrab%2Fturso-per-user-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notrab%2Fturso-per-user-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notrab%2Fturso-per-user-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notrab","download_url":"https://codeload.github.com/notrab/turso-per-user-starter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445667,"owners_count":20939958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["multitenancy","nextjs","sqlite","turso"],"created_at":"2024-11-21T22:52:15.594Z","updated_at":"2025-04-06T07:09:53.241Z","avatar_url":"https://github.com/notrab.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Turso Per User Starter\n\nA Next.js application that demonstrates how to use the [Turso](https://turso.tech) Platforms API to create a database per user.\n\n![Turso Per User Starter Template](/app/opengraph-image.png)\n\n## Demo\n\nThe app below uses a database per user, and is powered by Turso.\n\n[https://turso-per-user-starter.vercel.app](https://turso-per-user-starter.vercel.app)\n\n## Get Started\n\nDeploy your own Turso powered platform in a few easy steps...\n\n- [Create a Database](https://sqlite.new?dump=https%3A%2F%2Fraw.githubusercontent.com%2Fnotrab%2Fturso-per-user-starter%2Fmain%2Fdump.sql)\n\n  - Once the database is created, you'll be presented with details about your database, and **Connect** details\n  - Note down the following (you'll need these later):\n    - Database name\n    - Org name\n    - Group Token (**Create Group Token** -\u003e **Create Token**)\n    - Platform API Token (**Create Platform API Token** -\u003e **Insert memorable name** -\u003e **Create Token**))\n\n- [Sign up to Clerk](https://clerk.com)\n  - Create a new application from the dashboard\n  - Note down the following (you'll need these later):\n    - Public key\n    - Secret key\n- [Deploy with Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fnotrab%2Fturso-per-user-starter\u0026env=NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,CLERK_SECRET_KEY,TURSO_API_TOKEN,TURSO_ORG,TURSO_DATABASE_NAME,TURSO_GROUP_AUTH_TOKEN\u0026demo-title=Turso%20Per%20User%20Starter\u0026demo-description=Create%20a%20database%20per%20user\u0026demo-image=https://raw.githubusercontent.com/notrab/turso-per-user-starter/28373b4c9c74f814e3749525ee3d53b603176834/app/opengraph-image.png\u0026demo-url=https%3A%2F%2Fturso-per-user-starter.vercel.app)\n  - Add the following environment variables (from the details you noted down earlier):\n    - `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` - Clerk public key\n    - `CLERK_SECRET_KEY` - Clerk secret key\n    - `TURSO_API_TOKEN` - Platform API Token\n    - `TURSO_ORG` - Org name\n    - `TURSO_DATABASE_NAME` - Database name\n    - `TURSO_GROUP_AUTH_TOKEN` - Group Token\n  - Click **Deploy** and you're done!\n\n_You may optionally set up webhooks to automate the creation of databases in the background \u0026mdash; [learn more](https://github.com/notrab/turso-per-user-starter/wiki/Webhooks#using-webhooks-in-production)._\n\n## Local Development\n\nStart building your Turso powered platform in a few simple steps...\n\n1. \u003cdetails\u003e\n   \u003csummary\u003eClone this repository\u003c/summary\u003e\n\n   Begin by cloning this repository to your machine:\n\n   ```bash\n   git clone https://github.com/notrab/turso-per-user-starter.git\n   cd turso-per-user-starter\n   ```\n\n   \u003c/details\u003e\n\n2. \u003cdetails\u003e\n   \u003csummary\u003eInstall dependencies and initialize \u003ccode\u003e.env\u003c/code\u003e\u003c/summary\u003e\n\n   Run the following:\n\n   ```bash\n   cp .env.example .env\n   npm install\n   ```\n\n   \u003c/details\u003e\n\n3. \u003cdetails\u003e\n   \u003csummary\u003eCreate a new Turso database with Turso\u003c/summary\u003e\n\n   Follow the instructions to install the [Turso CLI](https://docs.turso.tech/cli/installation), and then run the following:\n\n   ```bash\n   turso db create \u003cdatabase-name\u003e\n   ```\n\n   \u003e Alternatively, you can [sign up](https://app.turso.tech) on the web, and create a new database from there.\n\n   Now update `.env` to include your organization, and database name:\n\n   ```bash\n   TURSO_ORG=\n   TURSO_DATABASE_NAME=\n   ```\n\n   \u003e The `TURSO_ORG` can be your personal username, or the name of any organization you have with other users.\n\n   \u003c/details\u003e\n\n4. \u003cdetails\u003e\n   \u003csummary\u003eCreate a new group token\u003c/summary\u003e\n\n   Run the following:\n\n   ```bash\n   turso group tokens create \u003cdatabase-name\u003e\n   ```\n\n   Now update `.env` to include the group token:\n\n   ```bash\n   TURSO_GROUP_AUTH_TOKEN=\n   ```\n\n   \u003e If you didn't already have one, a new group will be created for you with the name `default`.\n\n   \u003c/details\u003e\n\n5. \u003cdetails\u003e\n   \u003csummary\u003eRun database migrations\u003c/summary\u003e\n\n   Run the following:\n\n   ```bash\n   npm run db:migrate\n   ```\n\n   \u003e If you make changes to `db/schema.ts`, make sure to run `npm run db:generate` to create the migrations, and `npm run db:migrate` to apply them.\n\n   \u003c/details\u003e\n\n6. \u003cdetails\u003e\n   \u003csummary\u003eCreate a new Turso API Token\u003c/summary\u003e\n\n   Run the following:\n\n   ```bash\n   turso auth api-tokens mint clerk\n   ```\n\n   Then set the API token in the `.env` file:\n\n   ```bash\n   TURSO_API_TOKEN=\n   ```\n\n  \u003c/details\u003e\n\n7. \u003cdetails\u003e\n   \u003csummary\u003eConfigure Clerk\u003c/summary\u003e\n\n   [Sign up to Clerk](https://clerk.com) and create a new application.\n\n   Add your Clerk public key and secret key to the `.env` file:\n\n   ```bash\n   NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=\n   CLERK_SECRET_KEY=\n   ```\n\n   \u003c/details\u003e\n\n8. \u003cdetails\u003e\n   \u003csummary\u003eRun the application\u003c/summary\u003e\n\n   Run the following:\n\n   ```bash\n   npm run dev\n   ```\n\n   Now open [http://localhost:3000](http://localhost:3000) with your browser to try out the app!\n\n    \u003c/details\u003e\n\n## Optional: Webhook setup\n\nYou can automate the creation of databases per user in the background with webhooks.\n\n[Read the wiki](https://github.com/notrab/turso-per-user-starter/wiki/Webhooks#using-webhooks-locally) for more information on how to set up webhooks with Clerk during development, and production.\n\n## Tech Stack\n\n- [Turso](https://turso.tech) for multi-tenant databases\n- [Next.js](https://nextjs.org) for powerful full stack apps\n- [Tailwind CSS](https://tailwindcss.com) for utility-first CSS\n- [Drizzle](https://orm.drizzle.team) for database migrations and ORM\n- [Clerk](https://clerk.com) for authentication\n- [Vercel](https://vercel.com) for hosting\n\n## Need help?\n\n1. Open an issue on GitHub\n2. Submit a Pull Request to improve this repo\n3. [Join us on Discord](https://tur.so/discord)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotrab%2Fturso-per-user-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotrab%2Fturso-per-user-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotrab%2Fturso-per-user-starter/lists"}