aba - Angular + Better Auth
- Angular the frontend framework for building web applications
- Better Auth the authentication framework
- spartan/ui accessible, customizable components for Angular applications
- tRPC end-to-end typesafe APIs
- Prisma database migration and ORM
- NX monorepo tool for managing multiple applications and libraries in a single repository
Quick Start
Install dependencies
pnpm install
Copy the .env.dev file and fill in the BETTER_AUTH_SECRET and BETTER_AUTH_URL values.
cp .env.dev .env
Start postgres database with docker compose
docker compose up -d
Run the prisma migration to create the database and tables:
pnpm prisma migrate dev
Serve the analog app
pnpm start
Visit localhost:5173 to see the app running.
Sign up a new user and than you can seed the database with dummy data
pnpm prisma db seed
Better Auth
Run the following command to update prisma schema base on the Better Auth configuration:
# generate schema
pnpm auth generate --config apps/api/server/utils/auth.ts
Prisma
Run the following command to create the database and run the migrations:
pnpm prisma migrate dev
Generate the Prisma client:
pnpm prisma generate
App SSR
Build app and run app locally allowing access from localhost
pnpm build
NG_ALLOWED_HOSTS=localhost,127.0.0.1 node dist/apps/app/server/server.mjs
Apps in Docker
To run the application in Docker, update the .env file to point to the docker container names instead of localhost (database, redis, rustfs, better-auth).
The dockerfiles for the apps require the apps to be built first before starting the container.
pnpm build
Start the containers in detached mode:
docker compose -f compose.prod.yml up -d
When you rebuild the app use this command to rebuild the docker images:
docker compose -f compose.prod.yml up -d --build
评论