Workflow
Full Stack Development
Run Everything
From the project root:
docker-compose up
This starts:
- PostgreSQL database (port 5018 external, 5432 internal)
- Backend API (port 5017)
- Frontend (served by backend on port 5017)
Access the app at http://localhost:5017.
Root Scripts
| Command | Description |
|---|---|
npm run install:all | Install deps for backend, frontend, docs |
npm run build | Build backend and frontend |
npm run lint | Lint backend and frontend |
Code Style
Linting
Both backend and frontend use ESLint:
# Backend
cd backend && npm run lint
# Frontend
cd frontend && npm run lint
# Both (from root)
npm run lint
TypeScript
- Strict mode enabled
- Type definitions in
types/directories - Avoid
anywhen possible
Formatting
Consider using Prettier (not currently configured):
npm install --save-dev prettier
Contributing
Workflow
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature
- Make your changes
- Test thoroughly:
npm test # Backend tests
npm run lint # Linting
- Commit with clear messages:
git commit -m "Add: Feature description"
- Push to your fork:
git push origin feature/my-feature
- Open a Pull Request
Commit Message Format
Use conventional commits:
feat:New featurefix:Bug fixdocs:Documentation changesstyle:Code style changes (formatting)refactor:Code refactoringtest:Test additions or changeschore:Maintenance tasks
Pull Request Guidelines
- Clear description of changes
- Reference related issues
- Include tests for new features
- Update documentation as needed
- Ensure CI passes
Debugging
Backend Debugging
VS Code Launch Configuration:
{
"type": "node",
"request": "launch",
"name": "Debug Backend",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "dev"],
"cwd": "${workspaceFolder}/backend",
"console": "integratedTerminal"
}
Logs:
# View backend logs
docker-compose logs -f backend
# View database logs
docker-compose logs -f database
Frontend Debugging
- Use React DevTools browser extension
- Use browser developer tools
- Check network tab for API calls
- Check console for errors
Common Tasks
Reset Database
cd backend
npm run db:reset
Rebuild Docker Images
docker-compose build --no-cache
Clean Node Modules
# Backend
cd backend && rm -rf node_modules && npm install
# Frontend
cd frontend && rm -rf node_modules && npm install
View Database
docker-compose exec database psql -U trajectory_user -d trajectory
Useful queries:
-- List all children
SELECT * FROM children;
-- Count visits
SELECT COUNT(*) FROM visits;
-- View migrations
SELECT * FROM migrations;