Skip to content

xonoxc/Globo_backend

Repository files navigation

🌐 Globo Blog Backend

A robust and scalable backend service for the Globo blogging platform, built with Node.js, TypeScript, and Express.

License Node TypeScript Express

📋 Table of Contents

✨ Features

  • 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

🛠 Technologies

  • Node.js
  • TypeScript
  • Express.js
  • MySQL
  • Prisma ORM
  • Docker
  • Multer
  • Cloudinary

📝 Prerequisites

  • Node.js >= 18.0.0
  • Docker and Docker Compose
  • TypeScript >= 5.0.0
  • MySQL >= 8.0
  • Cloudinary account

🚀 Getting Started

  1. Clone the repository:
git clone https://github.com/yourusername/globo-backend.git
cd globo-backend
  1. Install dependencies:
npm install
  1. Set up environment variables:
cp .sample.env .env
  1. Start the MySQL container:
docker-compose up -d
  1. Run Prisma migrations:
npx prisma migrate dev
  1. Start the development server:
npm run dev

📁 Project Structure

Note

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

💾 Database

The application uses MySQL as the primary database, containerized with Docker. Prisma ORM is used for database operations.

📤 File Upload

File uploads are handled using Multer for temporary storage and Cloudinary for permanent storage.

Supported File Types

  • Images: .jpg, .jpeg, .png, .gif
  • Maximum file size: 5MB

🔐 Environment Variables

Create a .env file in the root directory

Production Build

# Create production build
npm run build

# Start production server
npm start

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


A project By xonoxc

Releases

No releases published

Packages

No packages published