Skip to content

gradely/project-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gradely Backend Services

Welcome to the Gradely backend services documentation! This repository serves as the central hub for understanding and integrating with the Gradely educational platform's backend architecture.

πŸ—οΈ Architecture Overview

Gradely's backend is built as a microservices architecture consisting of three core services that work together to provide a comprehensive educational platform:

graph TB
    subgraph "Backend Services"
        API[Gradely API v2<br/>PHP/Yii2]
        MAIN[Gradely-2.1<br/>Go/Gin]
        NOTIF[Notification Service<br/>Go/Gin]
    end

    subgraph "External Services"
        FIREBASE[Firebase<br/>Push Notifications]
        AWS_EMAIL[AWS<br/>Email]
        PAYSTACK[Paystack<br/>Payments]
        AWS_S3[AWS<br/>S3 File Storage]
    end

    subgraph "Infrastructure"
        MYSQL[(MySQL<br/>Database)]
        NOTIF_MYSQL[(Notification MySQL<br/>Database)]
        REDIS[(Redis<br/>Cache)]
    end

    API --> MYSQL
    MAIN --> MYSQL
    NOTIF --> NOTIF_MYSQL
    MAIN --> REDIS
    MAIN --> AWS_S3
    API --> AWS_S3
    NOTIF --> AWS_S3
    NOTIF --> AWS_EMAIL
    NOTIF --> FIREBASE
    MAIN --> PAYSTACK
Loading

πŸš€ Core Services

1. Gradely API v2 - Legacy API Service

Technology: PHP 7.4+ with Yii2 Framework
Port: Configurable via environment variable
Purpose: Legacy API endpoints and user authentication

Key Features:

  • User authentication and authorization
  • Legacy API endpoints for backward compatibility
  • Basic educational content management
  • User onboarding and profile management

Documentation: πŸ“ Repository | πŸ”§ Swagger UI

Note: Replace <your-port> with the port configured in your environment variables for each service. The default ports are typically 8080 or 8081, but may vary depending on your setup.


2. Gradely-2.1 - Main API Service

Technology: Go with Gin Framework
Port: Configurable via environment variable
Purpose: Core educational platform functionality

Key Features:

  • Authentication & Authorization: JWT-based user management
  • Student Management: Learning progress, homework, assessments
  • Teacher Tools: Class management, grading, live sessions
  • Parent Dashboard: Student monitoring and progress tracking
  • School Administration: Multi-school management
  • Payment Processing: Subscription and payment handling
  • Live Classes: Real-time tutoring and live sessions
  • AI Integration: Adaptive learning recommendations
  • Content Management: Educational resources and libraries

Documentation: πŸ“ Repository | πŸ”§ Swagger UI

Note: Replace <your-port> with the port configured in your environment variables for each service. The default ports are typically 8080 or 8081, but may vary depending on your setup.


3. Notification Service v2.1 - Communication Service

Technology: Go with Gin Framework
Port: Configurable via environment variable
Purpose: Multi-channel notification delivery

Key Features:

  • Multi-Channel Support: Email, SMS, WhatsApp, Push notifications
  • User-Specific Notifications: Parents, Teachers, Students, Schools
  • Template System: HTML and text email templates
  • Blacklist Management: User preference handling
  • Firebase Integration: Push notifications
  • Third-Party Integrations: Twilio, Termii
  • Background Processing: Asynchronous notification delivery

Documentation: πŸ“ Repository | πŸ”§ Swagger UI

Note: Replace <your-port> with the port configured in your environment variables for each service. The default ports are typically 8080 or 8081, but may vary depending on your setup.

πŸ”„ Service Communication

API Flow

  1. All services β†’ MySQL (shared database)
  2. Gradely-2.1 β†’ Redis (caching/session management)
  3. Gradely-2.1 β†’ Notification Service (User notifications)
  4. Gradely-2.1 β†’ External Services (Payments, Storage, etc.)

Integration Patterns

Gradely-2.1 β†’ Notification Service

// Example: Sending a notification from Gradely-2.1
notification := &NotificationModel{
    ActionName: "new_homework_parent",
    ReceiverID: "12345",
    ActionData: map[string]interface{}{
        "student_name": "John Doe",
        "subject": "Mathematics",
        "homework_title": "Algebra Practice",
        "due_date": "2024-01-15",
        "teacher_name": "Mrs. Smith",
    },
}

err := notification.SendNotification(config)

HTTP Endpoints

  • Notification Service: POST /notification/v2.1/
  • Blacklist Check: POST /notification/v2.1/check-blacklist-contact
  • Test Notifications: POST /notification/v2.1/test

πŸ› οΈ Development Setup

Prerequisites

  • Docker and docker compose
  • Go 1.17+ (for Gradely-2.1 and Notification Service)
  • PHP 7.4+ and Composer (for Gradely API v2)
  • MySQL 5.7+
  • Redis

Quick Start

  1. Clone all repositories:

    git clone https://github.com/gradely/gradely-api.git
    git clone https://github.com/gradely/gradely-2.1.git
    git clone https://github.com/gradely/notification-v2.1.git
  2. Start Gradely-2.1 (Main Service):

    cd gradely-2.1
    cp .env_services_sample .env
    # Edit .env with your settings
    make dev  # Starts all services with Docker
  3. Start Notification Service:

    cd notification-v2.1
    cp .env-sample .env
    # Edit .env with your settings
    go run main.go
  4. Start Gradely API v2 (Legacy):

    cd gradely-api
    composer install
    cp config/var.php.example config/var.php
    # Edit config/var.php with your settings
    php yii serve

Service URLs (Development)

πŸ“Š API Documentation

Each service provides comprehensive Swagger/OpenAPI documentation:

Service Local Docs Production Docs Repository
Gradely API v2 http://localhost:/docs https://api.gradely.ng/docs πŸ“ Repository
Gradely-2.1 http://localhost:/docs https://api.gradely.ng/docs πŸ“ Repository
Notification Service http://localhost:/docs https://notification.gradely.co/docs πŸ“ Repository

Note: Replace <your-port> with the port configured in your .env file for each service.

πŸ” Authentication

All services use JWT-based authentication:

# Include in request headers
Authorization: Bearer <your_jwt_token>

User Types

  • Student: Regular student users
  • Teacher: Teachers and tutors
  • Parent: Parent/guardian accounts
  • School: School administrator accounts

πŸ“± Notification System

The notification service supports multiple channels and user types:

Supported Channels

  • Email: HTML and text templates
  • SMS: Via Twilio and Termii
  • WhatsApp: Via Twilio
  • Push Notifications: Via Firebase

Common Notification Types

  • Parent: Homework assignments, exam schedules, progress reports
  • Teacher: Student submissions, class reminders, performance updates
  • Student: Assignment reminders, achievement notifications
  • School: System updates, usage reports, administrative alerts

πŸ—„οΈ Database Architecture

Shared Databases

  • MySQL: Primary data storage
  • Redis: Caching and session management (only Gradely-2.1 connects)

Database Separation

  • Gradely-2.1: Main application database
  • Notification Service: Notification-specific tables
  • Gradely API v2: Legacy data and user authentication

πŸš€ Deployment

Production URLs

Environment Configuration

Each service has its own configuration:

  • Gradely-2.1: .env
  • Notification Service: .env
  • Gradely API v2: config/var.php

🀝 Contributing

Development Workflow

  1. Fork the relevant repository
  2. Create a feature branch
  3. Make your changes
  4. Test with all three services
  5. Submit a pull request

Code Standards

  • Go: Follow Go conventions and best practices
  • PHP: Follow PSR-12 coding standards
  • Documentation: Update Swagger docs for API changes
  • Testing: Write tests for new features

πŸ“ž Support

Getting Help

  • Documentation: Check individual service READMEs
  • Issues: Create GitHub issues in relevant repositories
  • Email: [email protected]
  • Swagger UI: Interactive API testing and documentation

Common Issues

  • Port Conflicts: Ensure services run on different ports
  • Database Connections: Verify MySQL and Redis are running
  • Authentication: Check JWT token validity
  • Notifications: Verify Firebase and Twilio configurations

πŸ“„ License

This project is proprietary software owned by Gradely.


Made with ❀️ by the Gradely Team

For detailed documentation of each service, please visit their individual repositories and Swagger documentation.

About

A single place for guides, references, and documentation across all projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •