Stack-It is a full-stack application with:
- Frontend: React + TypeScript + Vite + Tailwind CSS
- Backend: Elysia (Bun) + Prisma + Turso (SQLite)
- Refactored Admin page from ~400 lines to ~111 lines by extracting reusable components
- Created shared
StatCardcomponent for dashboard statistics - Created
AdminUserTableandAdminPostTablecomponents with self-contained state - Moved admin API methods to shared
api.tslibrary
- Created shared auth middleware (
middleware/auth.ts) with:- Centralized JWT configuration
verifyAuth()andrequireAuth()helpers- Validation schemas for posts, discussions, comments, profiles
- Added proper HTTP status codes (400, 401, 403, 404, 500)
- Consistent error response format:
{ error: "message" }
- Implemented code-splitting with
React.lazy()for non-critical pages - Added
loading="lazy"anddecoding="async"to images - Created
formatPostSummary()to reduce payload size for list endpoints - Optimized backend queries to exclude unnecessary fields
- Backend tests using Bun's test runner (44 tests)
- Auth tests: signup, login, logout, token validation
- Posts tests: CRUD, authorization, favorites
- Admin tests: stats, user management, post management
- Frontend tests using Vitest + React Testing Library (34 tests)
- Component tests: TechTag, StatCard
- Context tests: AuthContext
- API client tests
- Admin role restricted to single email (
sehnyaw@gmail.com) - JWT-based authentication with HTTP-only cookies
- Input validation on all API endpoints
- Removed legacy server-rendered templates (Jinja)
- Removed legacy
pages.tsroute handler - Removed legacy
template.tslibrary - Removed legacy
static/folder
- Add more comprehensive E2E tests with Cypress
- Implement caching for trending tech list
- Add rate limiting to API endpoints
- Implement WebSocket for real-time updates