mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Improve developer setup
This commit is contained in:
parent
2d4d5df881
commit
14c9a202b8
10
.gitignore
vendored
10
.gitignore
vendored
@ -6,10 +6,7 @@
|
||||
.DS_Store
|
||||
.eslintcache
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
.env.*.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
@ -24,7 +21,6 @@ tmp
|
||||
node_modules
|
||||
|
||||
# Build dirs
|
||||
.env.*
|
||||
.next
|
||||
build
|
||||
dist
|
||||
@ -89,6 +85,7 @@ docs/docs/reference/core
|
||||
|
||||
# Next.js
|
||||
docs/docs/reference/nextjs
|
||||
next-env.d.ts
|
||||
|
||||
# SvelteKit
|
||||
packages/frameworks-sveltekit/index.*
|
||||
@ -112,3 +109,6 @@ docs/docs/reference/adapter
|
||||
|
||||
## Drizzle migration folder
|
||||
.drizzle
|
||||
|
||||
# Sentry Config File
|
||||
.sentryclirc
|
||||
|
||||
18
README.md
18
README.md
@ -67,12 +67,20 @@ For further configuration and usage, refer to [our documentation](https://docs.s
|
||||
|
||||
This is for you if you want to contribute to the Stack project.
|
||||
|
||||
### Requirements
|
||||
|
||||
- Node v20
|
||||
- pnpm v9
|
||||
- Docker
|
||||
|
||||
### Setup
|
||||
|
||||
Make sure you have `pnpm` installed alongside Node v20. Next, ensure you created `.env.local` files by copying `.env` in each sub-package in the `packages` folder and filling out the variables. You will need to start a Postgres database; you can do this with the following command:
|
||||
Pre-populated .env files for the setup below are available and used by default in `.env.development` in each of the packages, but you can choose to create your own `.env.local` files instead.
|
||||
|
||||
In a terminal, start the dependencies (Postgres and Inbucket) as Docker containers:
|
||||
|
||||
```sh
|
||||
docker run -it --rm -e POSTGRES_PASSWORD=password -p "5432:5432" postgres
|
||||
docker compose -f dependencies.compose.yaml up
|
||||
```
|
||||
|
||||
Then:
|
||||
@ -83,15 +91,15 @@ pnpm install
|
||||
# Run code generation (repeat this after eg. changing the Prisma schema)
|
||||
pnpm run codegen
|
||||
|
||||
# After starting a Postgres database and filling the corresponding variables in .env.local, push the schema to the database:
|
||||
# for production databases, use `deploy` instead. See: https://www.prisma.io/docs/orm/prisma-migrate/understanding-prisma-migrate/mental-model#prisma-migrate-in-a-staging-and-production-environment
|
||||
# Push the most recent Prisma schema to the database
|
||||
pnpm run prisma:server migrate reset
|
||||
|
||||
|
||||
# Start the dev server
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
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`.
|
||||
|
||||
You can also open Prisma Studio to see the database interface and edit data directly:
|
||||
|
||||
```sh
|
||||
|
||||
6
apps/cjs-test/.env.development
Normal file
6
apps/cjs-test/.env.development
Normal file
@ -0,0 +1,6 @@
|
||||
# Contains the credentials for the internal project of Stack's default development environment setup.
|
||||
# Do not use in a production environment, instead replace it with actual values gathered from https://app.stack-auth.com.
|
||||
NEXT_PUBLIC_STACK_URL=http://localhost:8101
|
||||
NEXT_PUBLIC_STACK_PROJECT_ID=internal
|
||||
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=this-publishable-client-key-is-for-local-development-only
|
||||
STACK_SECRET_SERVER_KEY=this-secret-server-key-is-for-local-development-only
|
||||
6
apps/custom-pages-example/.env.development
Normal file
6
apps/custom-pages-example/.env.development
Normal file
@ -0,0 +1,6 @@
|
||||
# Contains the credentials for the internal project of Stack's default development environment setup.
|
||||
# Do not use in a production environment, instead replace it with actual values gathered from https://app.stack-auth.com.
|
||||
NEXT_PUBLIC_STACK_URL=http://localhost:8101
|
||||
NEXT_PUBLIC_STACK_PROJECT_ID=internal
|
||||
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=this-publishable-client-key-is-for-local-development-only
|
||||
STACK_SECRET_SERVER_KEY=this-secret-server-key-is-for-local-development-only
|
||||
6
apps/demo/.env.development
Normal file
6
apps/demo/.env.development
Normal file
@ -0,0 +1,6 @@
|
||||
# Contains the credentials for the internal project of Stack's default development environment setup.
|
||||
# Do not use in a production environment, instead replace it with actual values gathered from https://app.stack-auth.com.
|
||||
NEXT_PUBLIC_STACK_URL=http://localhost:8101
|
||||
NEXT_PUBLIC_STACK_PROJECT_ID=internal
|
||||
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=this-publishable-client-key-is-for-local-development-only
|
||||
STACK_SECRET_SERVER_KEY=this-secret-server-key-is-for-local-development-only
|
||||
6
apps/e2e/.env.development
Normal file
6
apps/e2e/.env.development
Normal file
@ -0,0 +1,6 @@
|
||||
# Contains the credentials for the internal project of Stack's default development environment setup.
|
||||
# Do not use in a production environment, instead replace it with actual values gathered from https://app.stack-auth.com.
|
||||
NEXT_PUBLIC_STACK_URL=http://localhost:8101
|
||||
NEXT_PUBLIC_STACK_PROJECT_ID=internal
|
||||
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=this-publishable-client-key-is-for-local-development-only
|
||||
STACK_SECRET_SERVER_KEY=this-secret-server-key-is-for-local-development-only
|
||||
6
apps/middleware/.env.development
Normal file
6
apps/middleware/.env.development
Normal file
@ -0,0 +1,6 @@
|
||||
# Contains the credentials for the internal project of Stack's default development environment setup.
|
||||
# Do not use in a production environment, instead replace it with actual values gathered from https://app.stack-auth.com.
|
||||
NEXT_PUBLIC_STACK_URL=http://localhost:8101
|
||||
NEXT_PUBLIC_STACK_PROJECT_ID=internal
|
||||
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=this-publishable-client-key-is-for-local-development-only
|
||||
STACK_SECRET_SERVER_KEY=this-secret-server-key-is-for-local-development-only
|
||||
6
apps/partial-prerendering/.env.development
Normal file
6
apps/partial-prerendering/.env.development
Normal file
@ -0,0 +1,6 @@
|
||||
# Contains the credentials for the internal project of Stack's default development environment setup.
|
||||
# Do not use in a production environment, instead replace it with actual values gathered from https://app.stack-auth.com.
|
||||
NEXT_PUBLIC_STACK_URL=http://localhost:8101
|
||||
NEXT_PUBLIC_STACK_PROJECT_ID=internal
|
||||
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=this-publishable-client-key-is-for-local-development-only
|
||||
STACK_SECRET_SERVER_KEY=this-secret-server-key-is-for-local-development-only
|
||||
@ -3,10 +3,10 @@ NEXT_PUBLIC_STACK_URL=# enter your stack endpoint here, For local development: h
|
||||
NEXT_PUBLIC_STACK_PROJECT_ID=internal
|
||||
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=# enter your Stack publishable client key here. For local development, just enter a random string, then run `pnpm prisma:server migrate reset`
|
||||
STACK_SECRET_SERVER_KEY=# enter your Stack secret client key here. For local development, do the same as above
|
||||
SERVER_SECRET=# enter your server secret here. This is used to sign the JWT tokens. Generated using `scripts/generateKey.ts`
|
||||
SERVER_SECRET=# enter a secret key generated by `scripts/generateKey.ts` here. This is used to sign the JWT tokens.
|
||||
|
||||
# OAuth
|
||||
# These are optional for local development if you don't use OAuth
|
||||
# OAuth shared keys
|
||||
# Can be omitted for local development, but shared OAuth keys will not work
|
||||
GITHUB_CLIENT_ID=# client
|
||||
GITHUB_CLIENT_SECRET=# client secret
|
||||
GOOGLE_CLIENT_ID=# client id
|
||||
@ -33,7 +33,7 @@ DATABASE_CONNECTION_STRING=# enter your connection string here. For local develo
|
||||
DIRECT_DATABASE_CONNECTION_STRING=# enter your direct (unpooled or session mode) database connection string here. For local development: same as above
|
||||
|
||||
# Misc
|
||||
STACK_ACCESS_TOKEN_EXPIRATION_TIME=# enter the expiration time for the access token here, optional
|
||||
STACK_ACCESS_TOKEN_EXPIRATION_TIME=# enter the expiration time for the access token here. Optional, don't specify it for default value
|
||||
NEXT_PUBLIC_STACK_HEAD_TAGS=[{ "tagName": "script", "attributes": {}, "innerHTML": "// insert head tags here" }]
|
||||
NEXT_PUBLIC_DOC_URL=https://docs.stack-auth.com
|
||||
|
||||
|
||||
18
packages/stack-server/.env.development
Normal file
18
packages/stack-server/.env.development
Normal file
@ -0,0 +1,18 @@
|
||||
NEXT_PUBLIC_STACK_URL=http://localhost:8101
|
||||
SERVER_SECRET=23-wuNpik0gIW4mruTz25rbIvhuuvZFrLOLtL7J4tyo
|
||||
|
||||
NEXT_PUBLIC_STACK_PROJECT_ID=internal
|
||||
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=this-publishable-client-key-is-for-local-development-only
|
||||
STACK_SECRET_SERVER_KEY=this-secret-server-key-is-for-local-development-only
|
||||
|
||||
DATABASE_CONNECTION_STRING=postgres://postgres:password@localhost:5432/stackframe
|
||||
DIRECT_DATABASE_CONNECTION_STRING=postgres://postgres:password@localhost:5432/stackframe
|
||||
|
||||
NEXT_PUBLIC_DOC_URL=http://localhost:8104
|
||||
|
||||
EMAIL_HOST=0.0.0.0
|
||||
EMAIL_PORT=2500
|
||||
EMAIL_SECURE=false
|
||||
EMAIL_USERNAME=does not matter, ignored by Inbucket
|
||||
EMAIL_PASSWORD=does not matter, ignored by Inbucket
|
||||
EMAIL_SENDER=noreply@example.com
|
||||
3
packages/stack-server/.gitignore
vendored
3
packages/stack-server/.gitignore
vendored
@ -34,6 +34,3 @@ yarn-error.log*
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
# Sentry Config File
|
||||
.sentryclirc
|
||||
|
||||
@ -37,7 +37,7 @@ async function seed() {
|
||||
create: {
|
||||
allowLocalhost: true,
|
||||
oauthProviderConfigs: {
|
||||
create: (['github', 'facebook', 'spotify', 'google', 'microsoft'] as const).map((id) => ({
|
||||
create: (['github', 'facebook', 'google', 'microsoft'] as const).map((id) => ({
|
||||
id,
|
||||
proxiedOAuthConfig: {
|
||||
create: {
|
||||
|
||||
@ -45,7 +45,7 @@ export function OnboardingDialog() {
|
||||
>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Typography className="mb-4">
|
||||
Congratulations on creating your new project! We have automatically created an API key for you. Please copy it to your <InlineCode>.env.local</InlineCode> file. Get more information in the <StyledLink target="_blank" href={process.env.NEXT_PUBLIC_DOC_URL || ""}>getting started guide</StyledLink>.
|
||||
Congratulations on creating your new project! We have automatically created an API key for you. Please copy it to your <InlineCode>.env.local</InlineCode> file. Get more information in the <StyledLink target="_blank" href={process.env.NEXT_PUBLIC_DOC_URL || ""}>Getting Started guide</StyledLink>.
|
||||
</Typography>
|
||||
<EnvKeys projectId={project.id} publishableClientKey={apiKey?.publishableClientKey} secretServerKey={apiKey?.secretServerKey} />
|
||||
<Typography type="label">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user