Skip to content

Commit 73000ab

Browse files
committed
chore: initial project setup
1 parent b2c5da9 commit 73000ab

82 files changed

Lines changed: 39221 additions & 53 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Database
2+
DATABASE_URL=postgresql://expense_pet:local_password@localhost:5432/expense_pet
3+
4+
# Auth
5+
JWT_SECRET=change-me-in-production-must-be-32-chars
6+
JWT_REFRESH_SECRET=change-me-too-in-production-32-chars
7+
8+
# Server
9+
PORT=3000
10+
NODE_ENV=development
11+
12+
# Frontend
13+
VITE_API_URL=http://localhost:3000

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, dev]
6+
pull_request:
7+
branches: [main, dev]
8+
9+
# Cancel in-progress runs for the same branch
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
ci:
16+
name: Lint, Typecheck, Test, Build
17+
runs-on: ubuntu-latest
18+
19+
services:
20+
postgres:
21+
image: postgres:16-alpine
22+
env:
23+
POSTGRES_USER: test
24+
POSTGRES_PASSWORD: test
25+
POSTGRES_DB: test
26+
ports:
27+
- 5432:5432
28+
options: >-
29+
--health-cmd pg_isready
30+
--health-interval 10s
31+
--health-timeout 5s
32+
--health-retries 5
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: 25
42+
cache: 'npm'
43+
44+
- name: Install dependencies
45+
run: npm ci
46+
47+
- name: Generate Prisma Client
48+
run: cd apps/api && npx prisma generate
49+
50+
- name: Run migrations
51+
run: cd apps/api && npx prisma migrate deploy
52+
env:
53+
DATABASE_URL: postgresql://test:test@localhost:5432/test
54+
55+
- name: Lint (Biome)
56+
run: npm run lint:ci
57+
58+
- name: Typecheck
59+
run: npm run typecheck
60+
61+
- name: Test
62+
run: npm run test
63+
env:
64+
DATABASE_URL: postgresql://test:test@localhost:5432/test
65+
JWT_SECRET: test-secret-that-is-at-least-32-chars-long
66+
JWT_REFRESH_SECRET: test-refresh-secret-at-least-32-chars
67+
NODE_ENV: test
68+
69+
- name: Build
70+
run: npm run build

.gitignore

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
1-
/tmp
2-
/out-tsc
1+
# Dependencies
2+
node_modules/
33

4-
/node_modules
5-
npm-debug.log*
6-
yarn-debug.log*
7-
yarn-error.log*
8-
/.pnp
9-
.pnp.js
4+
# Build
5+
dist/
6+
.turbo/
107

11-
.vscode/*
8+
# Environment
9+
.env
10+
.env.local
11+
.env.*.local
1212

13-
.idea
13+
# IDE
14+
.vscode/settings.json
15+
.idea/
16+
17+
# OS
18+
.DS_Store
19+
Thumbs.db
20+
21+
# Logs
22+
*.log
23+
24+
# Test coverage
25+
coverage/
26+
27+
# Prisma
28+
apps/api/prisma/*.db
29+
30+
# Playwright
31+
playwright-report/
32+
test-results/

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
25

CLAUDE.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Expense Pet is a personal expense tracking app with gamification (virtual pet companion, points, streaks). Full-stack TypeScript monorepo, early stage — shared schemas exist but apps/api and apps/web are not yet implemented. Documentation is in Russian.
8+
9+
## Monorepo Structure
10+
11+
- **Turborepo** with npm workspaces
12+
- `apps/api/` — Fastify backend (planned, not yet built)
13+
- `apps/web/` — Vite + React frontend (planned, not yet built)
14+
- `packages/shared/` — Zod validation schemas shared between frontend and backend (`@expense-pet/shared`)
15+
16+
## Commands
17+
18+
```bash
19+
npm run dev # Start all apps in dev mode (turbo)
20+
npm run build # Build all packages/apps (turbo)
21+
npm run test # Run tests across workspaces (turbo)
22+
npm run lint # Biome check (linting + formatting)
23+
npm run lint:fix # Biome auto-fix
24+
npm run format # Biome format --write
25+
npm run typecheck # TypeScript type checking (turbo)
26+
npm run clean # Remove dist/, .turbo, node_modules
27+
```
28+
29+
## Tech Stack
30+
31+
- **Linting/Formatting:** Biome.js (not ESLint/Prettier) — single quotes, semicolons, 2-space indent, 100 char width
32+
- **Node version:** 25 (see `.nvmrc`)
33+
- **Validation:** Zod v4 schemas in `packages/shared`
34+
- **Planned backend:** Fastify, Prisma, PostgreSQL, JWT auth (argon2)
35+
- **Planned frontend:** React 19, React Router v7, TanStack Query, React Hook Form
36+
37+
## Architecture (from docs/)
38+
39+
- **3-layer pattern:** Routes (HTTP) → Services (business logic) → Repository (data access via Prisma)
40+
- Shared Zod schemas are the single source of truth for validation between frontend and backend
41+
- Conventional commits: `feat:`, `fix:`, `chore:`, `test:`, `docs:`
42+
- Feature-based folder organization (not by file type)
43+
- Detailed implementation roadmap in `docs/expense-pet-roadmap.md` (10 stages, Stage 0 = foundation CRUD + auth)
44+
45+
## Biome Configuration Notes
46+
47+
- `noConsole`: warn (allows `console.warn`, `console.error`, `console.info`)
48+
- `noExplicitAny`: warn (disabled in test files)
49+
- `noUnusedVariables`: warn
50+
- Ignored paths: `node_modules`, `dist`, `.turbo`, `coverage`, Prisma migrations, `*.gen.ts`

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Expense Pet
2+
3+
Personal expense tracking app with gamification — virtual pet companion, points, and streaks.
4+
5+
Full-stack TypeScript monorepo, early stage.
6+
7+
## Tech Stack
8+
9+
| Layer | Technology |
10+
| ----------- | --------------------------------------------------- |
11+
| Frontend | React 19, Vite 7, React Router v7, TanStack Query |
12+
| Backend | Fastify 5, Prisma 7, PostgreSQL 16 |
13+
| Auth | JWT (access + refresh tokens), argon2 |
14+
| Validation | Zod v4 (shared schemas between frontend and backend)|
15+
| Tooling | Turborepo, Biome.js, Husky, lint-staged |
16+
| Testing | Vitest, Testing Library |
17+
| Runtime | Node.js 25 |
18+
19+
## Project Structure
20+
21+
```
22+
expense-pet/
23+
├── apps/
24+
│ ├── api/ # Fastify backend
25+
│ └── web/ # Vite + React frontend
26+
├── packages/
27+
│ └── shared/ # Zod validation schemas (@expense-pet/shared)
28+
├── docs/ # Architecture and setup documentation (RU)
29+
├── biome.json
30+
├── turbo.json
31+
└── docker-compose.yml
32+
```
33+
34+
## Prerequisites
35+
36+
- Node.js >= 24 (see `.nvmrc` for exact version)
37+
- Docker (for PostgreSQL)
38+
39+
## Getting Started
40+
41+
```bash
42+
# Clone and install
43+
git clone <repo-url>
44+
cd expense-pet
45+
nvm use
46+
npm install
47+
48+
# Start PostgreSQL
49+
docker compose up -d
50+
51+
# Generate Prisma client and run migrations
52+
cd apps/api
53+
npx prisma generate
54+
npx prisma migrate dev
55+
cd ../..
56+
57+
# Start all apps in dev mode
58+
npm run dev
59+
```
60+
61+
The API runs on `http://localhost:3000`, the web app on `http://localhost:5173`.
62+
63+
## Scripts
64+
65+
```bash
66+
npm run dev # Start all apps (turbo)
67+
npm run build # Build all packages/apps
68+
npm run test # Run tests across workspaces
69+
npm run lint # Biome check (linting + formatting)
70+
npm run lint:fix # Biome auto-fix
71+
npm run lint:ci # Biome CI mode (strict, for CI pipelines)
72+
npm run format # Biome format
73+
npm run typecheck # TypeScript type checking
74+
npm run clean # Remove dist/, .turbo, node_modules
75+
```
76+
77+
## Architecture
78+
79+
- **3-layer pattern:** Routes (HTTP) → Services (business logic) → Repository (Prisma)
80+
- Shared Zod schemas as single source of truth for validation
81+
- Feature-based folder organization
82+
- Conventional commits: `feat:`, `fix:`, `chore:`, `test:`, `docs:`
83+
84+
See `docs/` for detailed setup guide and DevOps roadmap.

apps/api/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
# Keep environment variables out of version control
3+
.env
4+
5+
/src/generated/prisma
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './index';
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* !!! This is code generated by Prisma. Do not edit directly. !!!
2+
/* eslint-disable */
3+
// biome-ignore-all lint: generated file
4+
module.exports = { ...require('.') };

0 commit comments

Comments
 (0)