Add README and technical docs
- README with quick start, package overview, links to docs - docs/setup.md — prerequisites, env vars, installation, running, testing - docs/architecture.md — monorepo structure, backend/frontend design - docs/api.md — full endpoint reference with permissions - docs/database.md — schema overview, migrations, multi-tenancy - docs/testing.md — test runner, suites, writing tests - Updated .env.example with all supported variables
This commit is contained in:
89
docs/setup.md
Normal file
89
docs/setup.md
Normal file
@@ -0,0 +1,89 @@
|
||||
# Development Setup
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [Bun](https://bun.sh) v1.1+
|
||||
- PostgreSQL 16
|
||||
- Valkey 8 (or Redis 7+)
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
git clone <repo-url> && cd forte
|
||||
bun install
|
||||
```
|
||||
|
||||
## Environment
|
||||
|
||||
Create a `.env` file in the project root:
|
||||
|
||||
```env
|
||||
DATABASE_URL=postgresql://forte:forte@localhost:5432/forte
|
||||
REDIS_URL=redis://localhost:6379
|
||||
JWT_SECRET=your-secret-here
|
||||
NODE_ENV=development
|
||||
```
|
||||
|
||||
### All Environment Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `DATABASE_URL` | `postgresql://forte:forte@localhost:5432/forte` | PostgreSQL connection string |
|
||||
| `REDIS_URL` | `redis://localhost:6379` | Valkey/Redis connection string |
|
||||
| `JWT_SECRET` | (auto-generated in dev) | Secret for signing JWTs. **Required in production.** |
|
||||
| `PORT` | `8000` | Backend API port |
|
||||
| `HOST` | `0.0.0.0` | Backend bind address |
|
||||
| `NODE_ENV` | — | `development`, `test`, or `production` |
|
||||
| `LOG_LEVEL` | `info` | Pino log level (`debug`, `info`, `warn`, `error`, `silent`) |
|
||||
| `LOG_FILE` | — | Path to log file (production only, also logs to stdout) |
|
||||
| `STORAGE_PROVIDER` | `local` | File storage provider (`local` or `s3`) |
|
||||
| `STORAGE_LOCAL_PATH` | `./data/files` | Local file storage directory |
|
||||
| `CORS_ORIGINS` | `*` (dev) | Comma-separated allowed origins |
|
||||
| `APP_URL` | `http://localhost:5173` | Frontend URL (used in password reset links) |
|
||||
|
||||
## Database
|
||||
|
||||
```bash
|
||||
# Create the database
|
||||
createdb forte
|
||||
|
||||
# Run migrations
|
||||
cd packages/backend
|
||||
source ../.env # or source .env from project root
|
||||
bunx drizzle-kit migrate
|
||||
```
|
||||
|
||||
## Running
|
||||
|
||||
```bash
|
||||
# From project root — starts all packages
|
||||
bun run dev
|
||||
|
||||
# Or individually:
|
||||
cd packages/backend && source .env && bun run dev # API on :8000
|
||||
cd packages/admin && bun run dev # UI on :5173
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
# API integration tests (starts a backend, seeds DB, runs HTTP tests)
|
||||
cd packages/backend
|
||||
source .env
|
||||
bun run api-test
|
||||
|
||||
# Filter by suite or tag
|
||||
bun run api-test --suite accounts
|
||||
bun run api-test --tag crud
|
||||
|
||||
# Unit tests
|
||||
bun run test
|
||||
```
|
||||
|
||||
## Useful Commands
|
||||
|
||||
```bash
|
||||
bun run lint # ESLint across all packages
|
||||
bun run format # Prettier write
|
||||
bun run build # Build all packages
|
||||
```
|
||||
Reference in New Issue
Block a user