A robust and scalable backend service for the Globo blogging platform, built with Node.js, TypeScript, and Express.
- Features
- Technologies
- Prerequisites
- Getting Started
- Project Structure
- Database
- File Upload
- Environment Variables
- Contributing
- License
- RESTful API endpoints for blog management
- User authentication and authorization
- MySQL database with Prisma ORM
- File upload handling with Multer and Cloudinary
- TypeScript for type safety
- Input validation and sanitization
- Error handling middleware
- Unit and integration tests
- Node.js
- TypeScript
- Express.js
- MySQL
- Prisma ORM
- Docker
- Multer
- Cloudinary
- Node.js >= 18.0.0
- Docker and Docker Compose
- TypeScript >= 5.0.0
- MySQL >= 8.0
- Cloudinary account
- Clone the repository:
git clone https://github.com/yourusername/globo-backend.git
cd globo-backend- Install dependencies:
npm install- Set up environment variables:
cp .sample.env .env- Start the MySQL container:
docker-compose up -d- Run Prisma migrations:
npx prisma migrate dev- Start the development server:
npm run devNote
this is a high level overview of the file structure the overall file structure may change as development progresses
src/
├── caching/ # redis config
├── controllers/ # Request handlers
├── middlewares/ # Custom middleware
├── models/ # Prisma schema and types
├── lib/ # libraries and utilities
├── routes/ # API routes
├── types/ # Common types
├── constants/ # constants
├── utils/ # Utility functions
├── cloudinary/ # cloudinary config
└── app/ # App configuration
└── index.ts # App entry point
The application uses MySQL as the primary database, containerized with Docker. Prisma ORM is used for database operations.
File uploads are handled using Multer for temporary storage and Cloudinary for permanent storage.
- Images: .jpg, .jpeg, .png, .gif
- Maximum file size: 5MB
Create a .env file in the root directory
# Create production build
npm run build
# Start production server
npm start- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
A project By xonoxc