Skip to content

LoveKhatri/Aegis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Awesome Backend

Go Report Card License: MIT

A production-ready backend foundation built with Go, featuring a robust authentication system, multi-database support, and essential backend services. This project provides a solid starting point for building scalable and secure web applications.

✨ Features

  • Comprehensive Authentication System:

    • OAuth 2.0 support for Google, GitHub, and Discord.
    • Secure session management with Redis.
    • CSRF protection on # Awesome Backend

    Maintenance Contributions Welcome Go Report Card License: MIT

    A production-ready backend foundation built with Go, featuring a robust authentication system, multi-database support, and essential backend services. This project provides a solid starting point for building scalable and secure web applications.

    Project Status: This project is not currently in active development, and there is no ETA for when development will resume. However, the existing codebase is stable and provides a solid foundation. I encourage open-source contributions! Please feel free to create issues for bugs or submit pull requests for fixes and improvements.

    ✨ Features

    • Comprehensive Authentication System:
      • OAuth 2.0 support for Google, GitHub, and Discord.
      • Secure session management with Redis.
      • CSRF protection on authenticated routes.
      • Role-based access control (RBAC) stubs.
    • Multi-Database Ready:
      • PostgreSQL: For structured, relational data (e.g., users, profiles).
      • MongoDB: For flexible, unstructured data.
      • Redis: For caching, session storage, and real-time messaging.
    • Robust Backend Services:
      • Structured Logging: Advanced logging with zap and lumberjack, with separate logs for different modules (app, auth, ratelimit, requests).
      • Rate Limiting: Middleware to protect against brute-force attacks and abuse.
      • Metrics & Monitoring: Integrated Prometheus for metrics and prepared for Grafana/Loki for visualization and log aggregation.
      • Configuration Management: Centralized and environment-based configuration using viper.
    • Containerized & Easy to Deploy:
      • Dockerized setup with docker-compose for all services.
      • Makefile with commands for building, testing, and running the application.

    πŸ› οΈ Tech Stack

    πŸš€ Getting Started

    Prerequisites

    Installation

    1. Clone the repository:

      git clone https://github.com/LoveKhatri/aegis.git
      cd aegis
    2. Set up environment variables: This project uses Infisical for secret management. You can either set up an Infisical project or create a .env file in the root directory.

      Rename .env.example to .env and fill in the required values:

      mv .env.example .env
    3. Run the services: The easiest way to get started is with Docker Compose, which will spin up the backend and all required databases.

      make docker

      This command uses infisical run to inject secrets. If you are using a .env file, you may need to adjust the docker-compose.yml or load the variables into your shell before running docker compose up.

    4. Run the application: You can run the application in development mode using the Makefile:

      make dev

      This will start the server on http://localhost:8080.

    πŸ“‚ Project Structure

    .
    β”œβ”€β”€ cmd/                  # Application entrypoint
    β”œβ”€β”€ config/               # Configuration files (Viper)
    β”œβ”€β”€ internal/             # Private application logic
    β”‚   β”œβ”€β”€ auth/             # Authentication services and logic
    β”‚   β”œβ”€β”€ server/           # Gin server setup, middleware, and routes
    β”‚   └── services/         # Connectors for external services (DBs, Kafka)
    β”œβ”€β”€ pkg/                  # Reusable packages (logger, metrics, ratelimit)
    β”œβ”€β”€ types/                # Shared data structures and types
    β”œβ”€β”€ docker-compose.yml    # Docker setup for all services
    β”œβ”€β”€ Dockerfile            # Dockerfile for the Go application
    └── Makefile              # Helper commands for development
    

    ↔️ API Endpoints

    The server exposes the following main endpoints:

    • GET /health: Health check.
    • GET /auth/:provider: Initiate OAuth2 flow (e.g., /auth/google).
    • GET /auth/:provider/callback: OAuth2 callback URL.
    • POST /auth/logout: Log out and clear the session.
    • GET /api/profile: Example protected route to get user profile.

    βš™οΈ Configuration

    The application is configured through YAML files in the /config directory and environment variables. Viper loads configuration in the following order:

    1. config/base.yaml
    2. config/{environment}.yaml (e.g., development.yaml)
    3. Environment variables

    See config/base.yaml for all available configuration options.

    🀝 Contributing

    Contributions are welcome! Please feel free to submit a Pull Request.

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

    πŸ“„ License

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

    • Role-based access control (RBAC) stubs.
  • Multi-Database Ready:

    • PostgreSQL: For structured, relational data (e.g., users, profiles).
    • MongoDB: For flexible, unstructured data.
    • Redis: For caching, session storage, and real-time messaging.
  • Robust Backend Services:

    • Structured Logging: Advanced logging with zap and lumberjack, with separate logs for different modules (app, auth, ratelimit, requests).
    • Rate Limiting: Middleware to protect against brute-force attacks and abuse.
    • Metrics & Monitoring: Integrated Prometheus for metrics and prepared for Grafana/Loki for visualization and log aggregation.
    • Configuration Management: Centralized and environment-based configuration using viper.
  • Containerized & Easy to Deploy:

    • Dockerized setup with docker-compose for all services.
    • Makefile with commands for building, testing, and running the application.

πŸ› οΈ Tech Stack

πŸš€ Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/LoveKhatri/aegis.git
    cd aegis
  2. Set up environment variables: This project uses Infisical for secret management. You can either set up an Infisical project or create a .env file in the root directory.

    Rename .env.example to .env and fill in the required values:

    mv .env.example .env
  3. Run the services: The easiest way to get started is with Docker Compose, which will spin up the backend and all required databases.

    make docker

    This command uses infisical run to inject secrets. If you are using a .env file, you may need to adjust the docker-compose.yml or load the variables into your shell before running docker compose up.

  4. Run the application: You can run the application in development mode using the Makefile:

    make dev

    This will start the server on http://localhost:8080.

πŸ“‚ Project Structure

.
β”œβ”€β”€ cmd/                  # Application entrypoint
β”œβ”€β”€ config/               # Configuration files (Viper)
β”œβ”€β”€ internal/             # Private application logic
β”‚   β”œβ”€β”€ auth/             # Authentication services and logic
β”‚   β”œβ”€β”€ server/           # Gin server setup, middleware, and routes
β”‚   └── services/         # Connectors for external services (DBs, Kafka)
β”œβ”€β”€ pkg/                  # Reusable packages (logger, metrics, ratelimit)
β”œβ”€β”€ types/                # Shared data structures and types
β”œβ”€β”€ docker-compose.yml    # Docker setup for all services
β”œβ”€β”€ Dockerfile            # Dockerfile for the Go application
└── Makefile              # Helper commands for development

↔️ API Endpoints

The server exposes the following main endpoints:

  • GET /health: Health check.
  • GET /auth/:provider: Initiate OAuth2 flow (e.g., /auth/google).
  • GET /auth/:provider/callback: OAuth2 callback URL.
  • POST /auth/logout: Log out and clear the session.
  • GET /api/profile: Example protected route to get user profile.

βš™οΈ Configuration

The application is configured through YAML files in the /config directory and environment variables. Viper loads configuration in the following order:

  1. config/base.yaml
  2. config/{environment}.yaml (e.g., development.yaml)
  3. Environment variables

See config/base.yaml for all available configuration options.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

πŸ“„ License

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published