feat(auth): setup base auth domain

This commit is contained in:
2026-01-24 03:44:24 +08:00
parent 037e36f4f4
commit c8dc3b19a5
68 changed files with 2089 additions and 928 deletions

View File

@@ -1,31 +1,4 @@
# Express Starter Template
A robust **Modular Monolith** template for building scalable Node.js applications using **TypeScript**, **Express**, and **Clean Architecture** principles.
## 🚀 Features
- **Modular Architecture**: Vertical slice architecture ensuring separation of concerns and scalability.
- **Clean Architecture**: Domain-centric design with clear boundaries between Domain, Use Cases, and Infrastructure.
- **Type Safety**: Built with **TypeScript** in `nodenext` mode for modern ESM support.
- **Dependency Injection**: Powered by **InversifyJS** for loose coupling and testability.
- **Database**: **PostgreSQL** integration using **Prisma ORM** for type-safe database access and schema management.
- **Validation**: Runtime request validation using **Zod**.
- **Linting & Formatting**: Fast and efficient tooling with **Biome**.
## 🛠️ Tech Stack
- **Runtime**: Node.js (>= 22.18.0)
- **Framework**: Express.js
- **Language**: TypeScript
- **DI Container**: InversifyJS
- **Database**: PostgreSQL + Prisma ORM
- **Validation**: Zod
- **Testing**: Vitest
- **Tooling**: Biome, tsx, Swagger
For the first version, I'm planning of just using Express.js and InversifyJS. In the future, I plan on using the [InversifyJS framework with the Express v5 adapter](https://inversify.io/framework/docs/introduction/getting-started/) as another branch.
The `inversify-express-utils` package is already deprecated so the focus should be on the new framework package instead.
# Cedar CMS (Backend Monolith)
## 🏁 Getting Started
@@ -40,7 +13,7 @@ The `inversify-express-utils` package is already deprecated so the focus should
1. Clone the repository:
```bash
git clone <repository-url>
cd express-starter
cd cedar-api
```
2. Install dependencies:
@@ -51,10 +24,10 @@ The `inversify-express-utils` package is already deprecated so the focus should
3. Set up environment variables:
Create a `.env` file in the root directory (refer to `.env.example` if available, otherwise configure your DB connection details).
4. Create the initial Prisma migration:
> Note: Run this command every time you make changes to the Prisma schema.
4. Setup the database with the codebase's schema:
> Note: Run `yarn prisma:migrate` every time you make changes to the Prisma schema.
```bash
yarn prisma:migrate
yarn prisma:push
```
5. Generate Prisma Client:
@@ -77,6 +50,9 @@ The `inversify-express-utils` package is already deprecated so the focus should
- `yarn format`: Format the codebase using Biome.
- `yarn test`: Run unit tests using Vitest.
- `yarn coverage`: Run tests with coverage reporting.
- `yarn prisma:push`: Pushes the state of the Prisma schema to the database without migrations.
- `yarn prisma:migrate`: Creates a new migration while reruning the existing migration history. (use for development only)
- `yarn prisma:generate`: Generates the Prisma Client with updated schema.
## 🧪 Testing