# Nessa API Server Backend infrastructure for Nessa's community features including clubs, challenges, and social sharing. ## Features - **Clubs**: Create, manage, and join communities around shared interests - **Challenges**: Create and participate in time-bound activities within clubs - **Social Feed**: Share updates, like posts, and comment within your community network ## Tech Stack - Node.js with Express.js - SQLite (better-sqlite3) for data persistence - RESTful API architecture ## Getting Started ### Prerequisites - Node.js 18+ - npm ### Installation ```bash cd nessa-api npm install ``` ### Running the Server ```bash # Development mode with auto-reload npm run dev # Production mode npm run start ``` The server will start on `http://localhost:3000` by default. ## API Endpoints ### Health Check - `GET /api/health` - Service health status - `GET /api/health/ready` - Readiness check - `GET /api/health/live` - Liveness check ### Clubs - `GET /api/clubs` - List all clubs - `GET /api/clubs/:id` - Get a specific club - `POST /api/clubs` - Create a new club - `PUT /api/clubs/:id` - Update a club - `DELETE /api/clubs/:id` - Delete a club - `GET /api/clubs/:id/members` - Get club members - `POST /api/clubs/:id/members` - Join a club ### Challenges - `GET /api/challenges` - List all challenges - `GET /api/challenges/:id` - Get a specific challenge - `POST /api/challenges` - Create a new challenge - `PUT /api/challenges/:id` - Update a challenge - `DELETE /api/challenges/:id` - Delete a challenge - `GET /api/challenges/:id/participants` - Get challenge participants - `POST /api/challenges/:id/participants` - Join a challenge - `POST /api/challenges/:id/submissions` - Submit challenge progress ### Social - `GET /api/social/feed` - Get user's social feed - `POST /api/social/posts` - Create a new post - `GET /api/social/posts/:id` - Get a specific post - `DELETE /api/social/posts/:id` - Delete a post - `POST /api/social/posts/:id/likes` - Like a post - `DELETE /api/social/posts/:id/likes` - Unlike a post - `POST /api/social/posts/:id/comments` - Comment on a post - `GET /api/social/posts/:id/comments` - Get post comments ## Environment Variables ```bash PORT=3000 NODE_ENV=development ``` ## Database The API uses SQLite for data persistence. The database file is created automatically at `src/data/nessa.db` when the server starts. ### Schema - **users** - User accounts (simplified, integrates with auth service in production) - **clubs** - Community groups - **club_memberships** - Club member relationships - **challenges** - Time-bound activities - **challenge_participants** - Challenge enrollment - **challenge_submissions** - Challenge progress tracking - **posts** - Social media posts - **likes** - Post likes - **comments** - Post comments ## Testing ```bash npm test ``` ## Project Structure ``` nessa-api/ ├── src/ │ ├── config/ │ │ └── database.js # Database setup and schema │ ├── models/ │ │ ├── Club.js # Club data layer │ │ ├── Challenge.js # Challenge data layer │ │ └── Social.js # Social features data layer │ ├── routes/ │ │ ├── health.js # Health check endpoints │ │ ├── clubs.js # Club endpoints │ │ ├── challenges.js # Challenge endpoints │ │ └── social.js # Social endpoints │ ├── utils/ # Utility functions │ └── index.js # Application entry point ├── package.json └── README.md ``` ## License MIT