Peptidescore

Top-level Files of tip
Login

Top-level Files of tip

Files in the top-level directory from the latest check-in


Finnrick Backend API

A complete Node.js backend with Express.js and MongoDB for the Finnrick application, featuring authentication and content delivery.

Features

🔐 Authentication Module

📦 Content Delivery Module

API Endpoints

Authentication

Content

Utility

Setup Instructions

1. Install Dependencies

cd backend
npm install

2. Environment Configuration

Copy .env.example to .env and configure:

cp .env.example .env

Required environment variables:

3. Start MongoDB

Make sure MongoDB is running on your system or use a cloud MongoDB service.

4. Run the Server

# Development mode with auto-reload
npm run dev

# Production mode
npm start

5. Seed Database (Optional)

curl -X POST http://localhost:5000/api/seed

Project Structure

backend/
├── src/
│   ├── config/
│   │   └── database.js          # MongoDB connection
│   ├── controllers/
│   │   ├── authController.js    # Authentication logic
│   │   └── contentController.js # Content management logic
│   ├── middleware/
│   │   ├── auth.js              # JWT authentication middleware
│   │   └── validation.js        # Input validation middleware
│   ├── models/
│   │   ├── User.js              # User model schema
│   │   └── Content.js           # Content model schema
│   ├── routes/
│   │   ├── auth.js              # Authentication routes
│   │   └── content.js           # Content routes
│   ├── utils/
│   │   └── seedData.js          # Database seeding utility
│   └── server.js                # Main server file
├── package.json
├── .env.example
└── README.md

Security Features

Sample Data

The seed script includes sample content across all categories:

OAuth Integration

The backend accepts OAuth user data from the frontend:

POST /api/auth/oauth
{
  "email": "user@example.com",
  "provider": "google",
  "socialId": "123456789",
  "avatar": "https://example.com/avatar.jpg"
}

Error Handling

Development

Testing

Health check endpoint available at /health to verify server status.

License

MIT License