Skip to content

Latest commit

 

History

History
148 lines (113 loc) · 4.36 KB

README.md

File metadata and controls

148 lines (113 loc) · 4.36 KB

telko-moment-server 🖥

  • Server to a maui mobile app for android chat-app.
  • The server uses gin from golang

[OLD PLAN]

About

  • Server to a flutter android chat-app.
  • The server uses nodejs and frameworks such as ExpressJs, featherJs, stompjs & Prisma ORM.
  • it is split into 2 different servers
    1. chat-server : for handling chats
    2. media-server : for handling media files or basically files
  • *more information on this will be found in the documentation folder
  • figma links for the designs:
    1. user maps & personas:    visit 🔗
    2. wire frame & prototype    visit 🔗

Requirements

Most of the server requirements are mostly javascript based and a few are other languages but mostly for supporting architecture. The requirements are as follows:

  1. Nodejs & NPM(Node Package Manager)
  2. ExpressJs
  3. FeathersJs
  4. Stompjs
  5. Prisma
  6. Databases
    1. Mongodb (server)
    2. SQLite (mobile)
  7. RabbitMQ
    • stomp plugin

Folder Structure

/
├───design/
├───documentation/
│   ├───mobile/
│   └───server/
└───server/
    ├───bin/
    ├───cmd/
    ├───configs/
    ├───internal/
    │   ├───audios/
    │   ├───auth/
    │   ├───messages/
    │   ├───pictures/
    │   ├───users/
    │   └───videos/
    ├───pkg/
    └───test/


The conventional Go project structure.

chat-app/
├── cmd/
│   └── server/
│       └── main.go           # Application entry point
├── internal/
│   ├── models/
│   │   ├── message.go        # Message data structures
│   │   └── user.go          # User data structures
│   ├── handlers/
│   │   ├── auth.go          # Authentication handlers
│   │   ├── message.go       # Message handling
│   │   └── websocket.go     # WebSocket connection handling
│   ├── repository/
│   │   ├── message_repo.go  # Message database operations
│   │   └── user_repo.go     # User database operations
│   └── service/
│       ├── auth_service.go  # Authentication business logic
│       └── chat_service.go  # Chat business logic
├── pkg/
│   ├── websocket/
│   │   └── client.go        # WebSocket client implementation
│   └── utils/
│       └── validator.go     # Common validation utilities
├── configs/
│   └── config.yaml          # Application configuration
├── api/
│   └── routes.go           # API route definitions
├── migrations/
│   └── schema.sql          # Database migrations
├── go.mod                  # Go module file
└── go.sum                  # Go module checksum file

Each directory and its purpose:

  1. cmd/: Contains the main applications of your project

    • This is where your main.go lives
    • Each subdirectory should match the name of the executable you want to build
  2. internal/: Contains private application code

    • models/: Data structures that represent your domain
    • handlers/: HTTP/WebSocket request handlers
    • repository/: Database interaction layer
    • service/: Business logic layer
  3. pkg/: Contains code that's ok to be used by external applications

    • Put reusable components here
    • In your case, websocket handling utilities could go here
  4. configs/: Configuration files

    • YAML, JSON, or other config files
    • Environment variables templates
  5. api/: API-related definitions

    • Route setup
    • API documentation
    • OpenAPI/Swagger specs if you use them
  6. migrations/: Database migration files

This structure follows these key Go principles:

  • Separation of concerns
  • Clear dependency direction (dependencies flow inward)
  • Package-by-feature rather than package-by-layer
  • Private application code in internal/
  • Shared code in pkg/