This is an analytics platform that tracks user events, generates reports, and provides dashboard insights. The current implementation is a working MVP that needs to be refactored into a production-ready system.
The application uses:
- NestJS framework
- SQLite database
- TypeScript
- Jest for testing
users- User information and plan typesevents- User events and analytics datareports- Generated reports and metadata
GET /analytics/dashboard- Get dashboard statisticsPOST /users- Create new userGET /users/analytics- Get user analyticsPOST /events- Track eventsGET /events- Get events by type and userGET /events/top- Get top eventsPOST /reports/generate- Generate formatted reportsGET /reports/:id/execute- Execute saved reportGET /analytics/metrics/:type- Calculate metrics
Refactor the current codebase into a vertical slice architecture following backend best practices.
- Install dependencies:
npm install - Setup database:
npm run setup - Start development server:
npm run start:dev - Test the API:
./test-api.sh - Run tests:
npm test - Check code quality:
npm run lint:check
npm run build- Compile TypeScriptnpm run start- Start production servernpm run start:dev- Start development servernpm run setup- Initialize databasenpm run test- Run testsnpm run lint- Fix linting issuesnpm run lint:check- Check for linting issues./test-api.sh- Test API endpoints
Good luck!