- Node.js
- Express.js
- TypeScript
- Prisma
- SQLite
- React
- Next.js
- TypeScript
- Tailwind CSS
- Initialize Node.js + Express.js project
- Configure TypeScript
- Setup SQLite + Prisma
- Setup project structure (routes, controllers, services)
- Configure environment variables
- Create Events table
- Create Users table
- Create Sessions table
- Setup Prisma migrations
- Basic Security
- Configure CORS
- Implement rate limiting
- Setup API error handling middleware
- Setup request validation middleware
- Event API Implementation
- Create event receiving endpoint
- Implement event storage logic
- Create event filtering and query API
- Implement event statistics API (daily/monthly)
- Set up admin account
- Implement JWT authentication
- Create visitor account mechanism
- Implement login/logout functionality
- Create permission middleware
- Monthly statistics endpoint
- Daily statistics endpoint
- Event distribution endpoint Data summary endpoint
Visitor System
- Implement visitor registration
- Create visitor permission management
- Setup visitor activity logging
- Custom date range queries
- Data export functionality (admin only)
- Trend analysis reports
- Health check endpoint
- Error logging
- System usage statistics
- Test Setup
- Configure Jest
- Setup test environment variables
- Configure test database (SQLite in-memory)
- EventService tests
- AuthService tests
- StatsService tests
- Date handling function tests
- Data conversion function tests
- Permission check function tests
- API Tests Setup
- Configure Supertest
- Setup test database
- Event creation tests
- Event query tests
- Event statistics tests
- Login flow tests
- Registration flow tests
- JWT verification tests
- Data statistics query tests
- Permission control tests
- Configure Cypress Visitor flow tests Admin operation flow tests
POST /api/events - Record new event
GET /api/events - Get event list (paginated)
GET /api/stats/daily - Get daily statistics
GET /api/stats/monthly - Get monthly statistics
POST /api/auth/login - User login
POST /api/auth/register - Visitor registration
interface Event {
id: string;
type: "github_click" | "linkedin_click" | "resume_download" | "article_click";
timestamp: Date;
metadata: {
referrer?: string;
userAgent?: string;
};
}
enum Role {
ADMIN = "admin",
VISITOR = "visitor",
}
interface Permission {
read: boolean;
write: boolean;
export: boolean;
}
src/
├── **tests**/
│ ├── unit/
│ │ ├── services/
│ │ └── utils/
│ ├── integration/
│ │ ├── events.test.ts
│ │ ├── auth.test.ts
│ │ └── stats.test.ts
│ └── e2e/
├── routes/
├── controllers/
├── services/
├── utils/
└── types/
- GitHub Actions Configuration
- Test automation
- Coverage reporting
- Deployment automation
- API Documentation
- Setup Instructions
- Development Guidelines
- Testing Guidelines