Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

jammutkarsh/cshare-server

Repository files navigation

Logo

📋 Table Of Content

🔍 Overview

cShare is a command-line utility built in Golang to send sensitive text data across devices. This repository is the backend server of cShare.

The back end is featured with

  • RESTful API for communication.
  • User authentication and authorization
  • Secure resource endpoints using JSON Web Tokens (JWT)
  • Single-file binary.
  • Containerized environment for portability and scalability.
  • API documentation using Postman

Technologies used

  • Go is the primary backend code.
  • PostgresSQL is the primary database for storing user authentication details, user data, and clip data.
  • Docker for containerizing and packaging software.

Framework used

  • Gin framework is the primary tool for building RESTful APIs.
  • cypherDecipher for password salting and un-salting.

🟢 Status

The backend (this project) is at stable version v1. It provides basic API endpoints for daily use. The official frontend command-line application is currently in development. You can also build your custom frontend(GUI, CLI or TUI) on top of this backend by following the docuementations.

📊 Digrams

Check here.

🔧 Usage

Before you ping the endpoints, Follow the steps to setup the inital configuration of the application.

🛠 System Prerequisite

NOTE: The entire application was developed only using Go and Docker installed in the system. PostgreSQL databases were running in Docker containers.

🚀 Running Locally

  1. Clone the repository JammUtkarsh/cshare-server
git clone https://github.com/JammUtkarsh/cshare-server
  1. Change directory to cshare-server
cd cshare-server
  1. Generate the .env file. It contains preferences depending upon development/debug or deployment/production. .env.local has default preferences for production.
cp .env.local .env 

💾 Starting the server database container

A. Using docker-compose

sudo docker compose up --build

B. Using pre-built image

# running databse with preconfigured tables.
docker volume create pgdata
docker pull jammutkarsh/cshare-db

docker run --rm -p 5432:5432 -v pgdata:/var/lib/postgresql/data jammutkarsh/cshare-db
# or

# OR

# building and running the container..
docker build -t cshare-db --target=database .

docker run --rm -p 5432:5432 -v pgdata:/var/lib/postgresql/data cshare-db

🏃‍♂️ Running The Application

go run .

The server will be now be accessable on port :5675 or as per the .env file

📚 API Documentation

See Postman API Documentation

Use Run In Postman on top right corner for best experience.

🤝 Contribution

This project is for learning purposes. Although you still can open issues if you find any. If possible, mention minimum amount of steps to reproduce the issue in the issue tab

🙏 Acknowledgement

I would like to give special thanks to the Go community, especially the Discord Community

📜 License

cShare is MIT Licensed