added dev:basic

This commit is contained in:
Zai Shi 2024-12-18 18:17:41 -08:00
parent 916f7d97af
commit 925c06ece4
3 changed files with 17 additions and 22 deletions

View File

@ -131,6 +131,8 @@ pnpm run start-deps
# Start the dev server
pnpm run dev
# For systems with limited resources, you can run a minimal development setup with just the backend and dashboard
# pnpm run dev:basic
# In a different terminal, run tests in watch mode
pnpm run test

View File

@ -64,46 +64,38 @@ git clone git@github.com:stack-auth/stack.git
cd stack
```
Pre-populated `.env` files for the setup below are available and used by default in `.env.development` in each package. Copy all the `.env.development` files to `.env.local` in the respective packages for local development.
Pre-populated .env files for the setup below are available and used by default in `.env.development` in each of the packages. (Note: If you're creating a production build (eg. with `pnpm run build`), you must supply the environment variables manually.)
In a terminal, start the dependencies (Postgres and Inbucket) as Docker containers:
```sh
docker compose -f dependencies.compose.yaml up
```
Then open a new terminal:
In a new terminal:
```sh
pnpm install
# Build everything once
pnpm run build
# Run build to build everything once
pnpm run build:dev
# Initialize the database and seed it with some data
pnpm prisma db push
pnpm prisma db seed
# Run code generation (repeat this after e.g., changing the Prisma schema). This is part of the build script but faster.
pnpm run codegen
# reset & start the dependencies (DB, Inbucket, etc.) as Docker containers, seeding the DB with the Prisma schema
pnpm run start-deps
# pnpm run restart-deps
# pnpm run stop-deps
# Start the dev server
pnpm run dev
# For systems with limited resources, you can run a minimal development setup with just the backend and dashboard
# pnpm run dev:basic
# In a different terminal, run tests in watch mode
pnpm run test
```
You can now open the dashboard at [http://localhost:8101](http://localhost:8101), the API on port 8102, a demo on port 8103, docs on port 8104, Inbucket (emails) on port 8105, and Prisma Studio on port 8106.
You can now open the dev launchpad at [http://localhost:8100](http://localhost:8100). From there, you can navigate to the dashboard at [http://localhost:8101](http://localhost:8101), API on port 8102, demo on port 8103, docs on port 8104, Inbucket (e-mails) on port 8105, and Prisma Studio on port 8106. See the dev launchpad for a list of all running services.
Your IDE may show errors on all `@stackframe/XYZ` imports. To fix this, restart the TypeScript language server; for example, in VSCode, you can open the command palette (Ctrl+Shift+P) and run `Developer: Reload Window` or `TypeScript: Restart TS server`.
Your IDE may show an error on all `@stackframe/XYZ` imports. To fix this, simply restart the TypeScript language server; for example, in VSCode you can open the command palette (Ctrl+Shift+P) and run `Developer: Reload Window` or `TypeScript: Restart TS server`.
### Database migrations
If you make changes to the Prisma schema, you need to run the following command to create a migration:
You can also open Prisma Studio to see the database interface and edit data directly:
```sh
pnpm run prisma migrate dev
pnpm run prisma studio
```
## Run individual services

View File

@ -24,6 +24,7 @@
"prisma": "only-allow pnpm && pnpm run --filter=@stackframe/stack-backend prisma",
"fern": "only-allow pnpm && pnpm run --filter=@stackframe/docs fern",
"dev": "only-allow pnpm && turbo run dev --concurrency 99999",
"dev:basic": "only-allow pnpm && turbo run dev --concurrency 99999 --filter=@stackframe/stack-backend --filter=@stackframe/stack-dashboard --filter=@stackframe/oauth-mock-server",
"start": "only-allow pnpm && turbo run start --concurrency 99999",
"start:backend": "only-allow pnpm && turbo run start --concurrency 99999 --filter=@stackframe/stack-backend",
"start:dashboard": "only-allow pnpm && turbo run start --concurrency 99999 --filter=@stackframe/stack-dashboard",