Skip to content

MP281X/romLinks_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RomLinks backend

Find custom roms for your devices

Why?

I wanted to create an app to help users to find and download custom rom for their devices in an easy way
Everyone can contribute to the project adding new custom roms to the app or by leaving reviews to those already present
This app was also an opportunity to build my first full-stack project and try new tecnology like Docker and InfluxDB

📘 Api documentation

The api documentation is the dart code used in the RomLinks Frontend
The code for the rest client is in the logic folder

Link to the Dart rest client for the RomLinks services:

🔧 Installation

The api is free without limitation but if you want to install all the services locally and test them you can download the repository, create the .env and run the command below
You need docker, docker-compose and Make to run the services

Configiration file .env

# influx db config
DOCKER_INFLUXDB_INIT_USERNAME=username
DOCKER_INFLUXDB_INIT_PASSWORD=password
influxToken=influxToken
influxOrg=orgName
influxBucket=bucketName
influxUri=http://influxdb:8086
metrics=false

# mongo config
MONGO_INITDB_ROOT_USERNAME=username
MONGO_INITDB_ROOT_PASSWORD=password
mongoUri=mongodb://username:password@mongodb:27017/?authSource=admin&readPreference=primary&ssl=false

# services config
jwtKey=jwtKey
logFile=false
tls=false

# grafana config
GF_SECURITY_ADMIN_PASSWORD=password

Shell command

# run all the services
make run
# stop all the services
make stop
# update all the container images
make update

👷‍♂️ Project Structure

The backend is subdivided in 4 independent microservices:

The services code is in the services folder

  • The *Services.go file contains the main function and another function for setting the db index or for generating the required folder
  • The *Handler folder contains the code of the api
  • The _handler file manage the api endpoint defined in the routes file
  • The _model file contains all the struct with the relative validation functions
  • The _db file contains all the db handler for storing and retriving data

The packages folder contains all the code that is reused in all the services:

  • The api folder contains all the gin setup and configuration and the apiRes helper function. It also contain the custom middleware for the metrics and for the errors log
  • The db folder contains the mongodb setup code
  • The logger folder contains the setup and the helper functions for writing logs to a file
  • The textSearch folder container the code for the search function

📜 License

GNU General Public License v3.0

📪 Contact

If you have any suggestion contact me

Telegram

🚀 Languages and tools