Skip to content

Commit

Permalink
added dev:basic
Browse files Browse the repository at this point in the history
  • Loading branch information
fomalhautb committed Dec 19, 2024
1 parent 916f7d9 commit 925c06e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 14 additions & 22 deletions docs/fern/docs/pages/others/self-host.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,46 +64,38 @@ git clone [email protected]: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.

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`.
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.

### Database migrations
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`.

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
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 925c06e

Please sign in to comment.