Skip to content

Repository files navigation

BANNER

nest docker docker
nest

Frontend: UTR Webpage Repo


Table of Contents


🚀 Project Overview

This backend powers a web application that brings all university services under one roof. 🎓 From managing student IDs to hosting a blog and image library, our NestJS-powered backend has everything you need for an efficient, scalable solution!

🛠️ Built with microservices for modularity and scalability!
🌐 Server-side rendering for optimized performance!
🔐 OAuth authentication for secure login!
📈 Real-time notifications and user activity tracking!


📦 Tech Stack

  • NestJS: For building the scalable and modular backend architecture
  • TypeScript: Writing safer and cleaner code
  • Docker: Containerizing the app for easy deployment
  • MongoDB: Document based database
  • OAuth: Secure authentication

🔧 Getting Started

Prerequisites

To get started, ensure you have the following installed:

Installation Steps

  1. Clone the repo:

    git clone https://github.com/yourusername/centralized-services-backend.git
  2. Navigate to the project directory:

    cd Web-Backend
  3. Install dependencies:

    npm install
  4. Create environment variables:

    Copy the .env.example file and rename it to .env. Make sure to add your database credentials and other necessary secrets.

    cp .env.example .env

📁 Project Structure

Breakdown:

`📦 project-root
 ┣ 📂 src                   # Main source code directory
 ┃ ┣ 📂 image-upload         # Module for image upload functionality
 ┃ ┣ 📂 test                 # Unit and integration tests
 ┣ 📂 uploads               # Directory where uploaded images are stored
 ┣ 📜 .dockerignore          # Ignore file for Docker builds
 ┣ 📜 .eslintrc.js           # ESLint configuration
 ┣ 📜 .gitignore             # Git ignore file
 ┣ 📜 .prettierrc            # Prettier configuration for code formatting
 ┣ 📜 README.md              # Readme file for project documentation
 ┣ 📜 docker-compose.yml     # Docker Compose configuration file
 ┣ 📜 dockerfile             # Dockerfile for building the project image
 ┣ 📜 nest-cli.json          # NestJS CLI configuration
 ┣ 📜 package.json           # Project dependencies and scripts
 ┣ 📜 pnpm-lock.yaml         # Lock file for package dependencies (PNPM)
 ┣ 📜 tsconfig.build.json    # TypeScript configuration for build
 ┣ 📜 tsconfig.json          # Base TypeScript configuration` 

🚦 Running the Backend

To run the backend locally:

docker-compose up --build

This will spin up the NestJS app along with the PostgreSQL and Redis services!

🧪 Running in Development Mode

npm run start:dev

💡 Pro Tip: Use npm run start:debug to enable live reloading and debugging while developing.


🔌 Microservices

Our backend is composed of multiple microservices to make it modular and scalable. Here’s what we’ve got under the hood:

  • Blog Microservice: For creating and managing blog posts 📖.
  • Student ID Microservice: For student profile and ID management 🆔.
  • Notifications Microservice: Real-time notifications 🚨.
  • Image Library Microservice: Handles image uploads and storage 🖼️.
  • Authentication Microservice: OAuth authentication and user sessions 🔐.

Each service runs independently but communicates through internal APIs. Neat, right? 😎


⚙️ Configuration

Environment variables are managed using the .env file. Here are some important variables you’ll want to configure:

PORT=3000                # Backend server port
DB_HOST=localhost         # Database host
DB_PORT=5432              # Database port
REDIS_HOST=localhost      # Redis host for caching
REDIS_PORT=6379           # Redis port
OAUTH_CLIENT_ID=xxxxxxxx  # OAuth client ID
OAUTH_CLIENT_SECRET=xxxx  # OAuth client secret

🛠️ Useful Commands

Start the app in development mode:

npm run start:dev

Run the app with Docker:

docker-compose up

Run tests:

npm run test

Build for production:

npm run build

🤝 Contributing

We love contributions! 🥳 If you want to help us improve the backend, here’s how you can contribute:

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

📄 License

This project is licensed under the MIT License. Check out the LICENSE file for more details.

📬 Contact

Have questions, suggestions, or just want to chat? Reach out to us!


Happy coding! 🎉

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages