Project Setup and Development Environment (ST-101)
Overview
Establishes the foundational project structure, development tooling, and local development environment. Sets up the monorepo with Nx, TypeScript, ESLint, Prettier, and Docker Compose for local services.
Project Structure
anchorpipe/
├── apps/
│ └── web/ # Next.js web application
├── libs/
│ └── database/ # Prisma database client
├── services/ # Microservices (future)
├── packages/ # Shared packages
├── infra/ # Infrastructure as code
└── apps/docs/docs/ # Documentation site content
Technology Stack
- Monorepo: Nx workspaces with npm
- Language: TypeScript 5.6+
- Framework: Next.js 14+ (App Router)
- Database: PostgreSQL 16+ with Prisma ORM
- Linting: ESLint 9+
- Formatting: Prettier 3+
- Containerization: Docker Compose
Development Environment
Prerequisites
- Node.js 20.x LTS
- npm 10.x
- Docker Desktop (or Docker Engine + Docker Compose V2)
- Git >= 2.40
Local Setup
-
Clone repository
git clone https://github.com/anchorpipe/anchorpipe.git
cd anchorpipe -
Start local services
docker compose up -dStarts: PostgreSQL, Redis, RabbitMQ, MinIO
-
Configure environment
echo DATABASE_URL=postgresql://postgres:postgres@localhost:15432/anchorpipe_dev > .env -
Install dependencies
npm install -
Run database migrations
npm run db:migrate -
Start development server
cd apps/web
npm run dev
Tooling
Linting
npm run lint
- ESLint configured for TypeScript
- Strict rules enabled
- Auto-fix available:
npm run lint -- --fix
Formatting
npm run format
- Prettier configured
- Consistent code style
- Pre-commit hooks (optional)
Type Checking
npx tsc --noEmit
- Strict TypeScript configuration
- Type safety across monorepo
Docker Services
PostgreSQL
- Port:
15432 - Database:
anchorpipe_dev - User:
postgres - Password:
postgres
Redis
- Port:
16379 - Used for: Rate limiting, caching (future)
RabbitMQ
- Port:
15672(Management UI) - Port:
5672(AMQP) - Used for: Message queue
MinIO (S3-compatible)
- Port:
9000(API) - Port:
9001(Console) - Used for: Object storage
Configuration Files
.gitignore- Git ignore rules.nvmrc- Node.js versionpackage.json- Dependencies and scriptstsconfig.base.json- TypeScript base configeslint.config.mjs- ESLint configurationprettier.config.mjs- Prettier configurationnx.json- Nx workspace configurationdocker-compose.yml- Local services
Scripts
npm run lint- Run ESLintnpm run format- Format code with Prettiernpm run test- Run all testsnpm run build- Build all projectsnpm run db:generate- Generate Prisma clientnpm run db:migrate- Run database migrationsnpm run db:studio- Open Prisma Studio
CI/CD
GitHub Actions workflows:
.github/workflows/ci.yml- Lint, typecheck, build, test.github/workflows/codeql.yml- Security scanning.github/workflows/security-scan.yml- Dependency scanning
Documentation
README.md- Project overviewCONTRIBUTING.md- Contribution guidelinesSECURITY.md- Security policyapps/docs/docs/- Comprehensive documentation
Related Documentation
- Database Schema - Database setup
- CI/CD Pipeline - CI/CD setup
- Authentication - Auth setup