TypeScript REST API
Express + PostgreSQL + Drizzle + JWT + Docker, in strict TypeScript.
atarashi new my-app --preset backend-ts
What you get
core/node-tsvalidation/zoddb/postgresorm/drizzlehttp/expressmw/corsmw/helmetmw/error-handlermw/rate-limitobs/pinoauth/jwtinfra/dockerinfra/docker-composelint/eslint-prettiertest/vitestci/githubmeta/readmemeta/licensemeta/editorconfig
Files
34 files, 21.4 KB before node_modules.
my-app/
├── .github/
│ └── workflows/
│ └── ci.yml
├── src/
│ ├── config/
│ │ └── env.ts
│ ├── db/
│ │ ├── client.ts
│ │ ├── index.ts
│ │ └── schema.ts
│ ├── lib/
│ │ ├── async-handler.ts
│ │ ├── http-error.ts
│ │ ├── http.ts
│ │ ├── jwt.ts
│ │ ├── logger.ts
│ │ └── password.ts
│ ├── middlewares/
│ │ ├── auth.ts
│ │ └── error-handler.ts
│ ├── routes/
│ │ └── index.ts
│ ├── app.ts
│ └── index.ts
├── tests/
│ └── health.test.ts
├── .dockerignore
├── .editorconfig
├── .env.example
├── .gitignore
├── .prettierignore
├── .prettierrc.json
├── Dockerfile
├── LICENSE
├── README.md
├── atarashi.json
├── docker-compose.yml
├── drizzle.config.ts
├── eslint.config.mjs
├── package.json
├── pnpm-workspace.yaml
├── tsconfig.json
└── vitest.config.ts
Dependencies
bcryptjs@^3.0.2cookie-parser@^1.4.7cors@^2.8.5dotenv@^17.4.2drizzle-orm@^0.44.6express@^4.21.2express-rate-limit@^7.5.1helmet@^8.1.0jsonwebtoken@^9.0.2pg@^8.16.3pino@^9.13.1pino-http@^10.5.0zod@^3.25.76
Development only:
@eslint/js@^9.37.0@types/bcryptjs@^3.0.0@types/cookie-parser@^1.4.9@types/cors@^2.8.19@types/express@^4.17.23@types/jsonwebtoken@^9.0.10@types/node@^22.19.0@types/pg@^8.15.5@types/supertest@^6.0.3@vitest/coverage-v8@^3.2.4drizzle-kit@^0.31.5eslint@^9.37.0eslint-config-prettier@^10.1.8pino-pretty@^13.1.2prettier@^3.6.2supertest@^7.1.4tsx@^4.20.6typescript@^5.9.3typescript-eslint@^8.45.0vitest@^3.2.4
After generating
- Start the dev server: pnpm run dev
- Copy
.env.exampleto.envand fill in the blanks - Start PostgreSQL: pnpm run db:up
- Set DATABASE_URL in .env
- Create the tables: pnpm run db:push
- Browse the data: pnpm run db:studio
- Check the API: curl http://localhost:3000/health
- Generate a signing key: openssl rand -hex 32
- Put it in .env as JWT_SECRET
- Build the image: docker build -t my-app .
- Bring the stack up: pnpm run compose:up
- Lint the project: pnpm run lint
- Run the tests: pnpm run test
- Tests read the same environment as the app, so export your .env before running them
- Push a branch and open a pull request to see CI run
- Fill in the blank values in
.env.exampleand copy it to.env
Change it
A preset is a starting point, not a cage. Add to it, drop from it, or eject:
atarashi new my-app --preset backend-ts --add obs/pino
atarashi new my-app --preset backend-ts --remove lint/biome --add lint/eslint-prettier
atarashi add auth/jwt # later, inside the generated project
Part of the atarashi documentation, written and maintained by Gautam Suthar.