Naqa API

Naqa API is a RESTful service designed to provide data on the purification process of Saudi stocks.
- Version: 1.0.0
- Environment: Development
- Base API Path:
/api/v1
Prerequisites
- Go 1.23.4 or higher
- Git
- MongoDB
Quick Start
- Clone the repository:
git clone https://github.com/anqorithm/naqa-api
cd naqa-api
- Install dependencies:
go mod download
- Set up environment variables:
cp .env.example .env
# Edit .env with your configurations
Installation
- Clone the project.
- Install Go dependencies:
go mod download
Environment
Set the following environment variables or edit the .env file:
- MONGO_URI
- MONGO_DATABASE
- PORT
Usage
- Run the server:
go run cmd/api/main.go
- Access the API at:
http://localhost:3000/api/v1
Environment Variables
Before running the application, make sure to set up your environment variables:
# Copy the example env file
cp .env.example .env
# Fill in your environment variables in .env file:
API_VERSION # API version
ENVIRONMENT # development, production, etc.
PORT # Server port
APP_NAME # Application name
APP_DESCRIPTION # Application description
MONGO_URI # MongoDB connection URI
MONGO_DATABASE # MongoDB database name
Running the Application
Local Development
go run cmd/api/main.go
Server will start at http://localhost:3000
Docker Setup
Using Docker Compose (Recommended)
# Start services
docker-compose up -d
# Stop services
docker-compose down
Manual Docker Build
# Build image
docker build -t naqa-api .
# Run container
docker run -d -p 3000:3000 naqa-api
API Endpoints
Base URL
http://localhost:3000/api/v1
Available Endpoints
GET / - API information
GET /health - Health check
GET /users - Users endpoints
GET /tasks - Tasks endpoints
Development
Project Structure
.
├── cmd
│ └── api
│ └── main.go
├── docker-compose.yml
├── Dockerfile
├── docs
│ ├── docs.go
│ ├── swagger.json
│ └── swagger.yaml
├── go.mod
├── go.sum
├── internal
│ ├── config
│ │ ├── config.go
│ │ └── mongodb.go
│ ├── handlers
│ │ ├── handlers.go
│ │ └── stocks.go
│ ├── middleware
│ │ ├── middleware.go
│ │ └── year_validator.go
│ └── routes
│ └── routes.go
├── LICENSE
├── Makefile
└── README.md
Building for Production
go build -o naqa-api cmd/api/main.go
License
This project is licensed under the MIT License - see the LICENSE file for details.