Skip to content

HeisenGo/rabbit-food

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Rabbit Food 🥕🍔

A Go Socket-Based Online Food Ordering System

Rabbit Food is a socket-based online food ordering system developed in Go. It provides a platform for users to order food from various restaurants, manage their profiles, and handle financial transactions securely. Restaurant owners can register and manage their establishments, while administrators have access to an admin panel for system management. The system leverages TCP connections and a custom protocol based on JSON and byte encoding for efficient client-server communication.

Key Features

  • User Registration and Profile Management: Users can create accounts, update their profiles, and manage personal information./n
  • Wallet Functionalities: Users can add funds to their wallets, facilitating secure online payments for food orders.
  • Food Ordering: Browse menus, select items, and place orders from registered restaurants.
  • Restaurant Creation and Management: Restaurant owners can create and manage their restaurant profiles, update menus, and track orders.
  • Admin Panel: Administrators have access to an admin panel for system management, user management, and monitoring.
  • CLI Client: A command-line interface (CLI) client allows users to manage orders, perform transactions, and interact with the system through a terminal interface.

Architecture

The system is designed with a modular architecture, separating the server and client components for scalability and maintainability. The server component handles client connections, processes requests, interacts with the database, and manages the overall system logic. The client component provides a user-friendly interface (CLI) for users to interact with the system. Communication between the server and clients is facilitated through TCP connections, ensuring efficient and reliable data transfer. A custom protocol is implemented to standardize the message formats and ensure seamless communication between the components.

Server Side Project Structure

├── api

│   └── tcp

├── cmd

│   └── server

├── config

├── internal

│   ├── errors

│   │   └── users

│   ├── models

│   │   └── user

│   ├── protocol

│   └── server

│       └── handlers

├── pkg

│   ├── adapters

│   │   └── storage

│   │       ├── entities

│   │       └── mappers

│   ├── jwt

│   ├── logger

│   └── utils

│       └── users

├── scripts

├── services

└── test

│   └──  users

Explanation:

  • api: Contains the TCP-related functionality.
  • cmd: Houses the server command files.
  • config: Stores configuration files.
  • internal: Holds internal packages and modules.
    • errors: Handles errors, specifically related to users.
    • models: Includes user-related models.
    • protocol: Contains protocol-related logic.
    • server/handlers: Contains handlers for server requests.
  • pkg: Contains packages used throughout the project.
    • adapters/storage: Includes storage-related adapters and mappers.
      • entities: Specific entities related to storage.
      • mappers: Data mappers for storage.
    • jwt: Logic related to JWT.
    • logger: Utilities for logging.
    • utils/users: Utility functions specifically for users.
  • scripts: Includes any scripts used in the project.
  • services: Contains service logic.
  • test/users: Contains test files specifically for user-related functionality.

Getting Started

To get started with Rabbit Food, follow the instructions in the following. The guide will walk you through the process of setting up the project, configuring the necessary dependencies, and running the server and client components.

How TO Run The Project

  1. Prepare your database.
  2. Create a PostGIS database named rabbit_food.
  3. To run the server:
    • Fill the .env file using sample.env.
    • Then, run go run cmd/api/main.go --envpath .env.
  4. To run the client:
    • Fill the .env file using sample.env.
    • Then, run go run cmd/main.go --envpath .env.

The project's database schema is represented by an Entity Relationship Diagram (ERD). You can view the ERD HERE.

Note: For better resolution of the ERD, open it with draw.io by selecting "Open with" and choosing "draw.io" from the options. You may need to authorize the site to view the diagram.

Contributing

We welcome contributions from the community! If you'd like to contribute to Rabbit Food, please read our Contributing Guidelines for information on how to get involved.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages