An open API service indexing awesome lists of open source software.

https://github.com/0bvim/go_rest_api

Golang restAPI using docker and postgres
https://github.com/0bvim/go_rest_api

Last synced: 4 months ago
JSON representation

Golang restAPI using docker and postgres

Awesome Lists containing this project

README

          

# RESTful API Project
> This readme is just a snippet that I've created and I will finish it latter.

This project implements a RESTful API using Go (Golang) as the backend language, PostgreSQL as the database, and Docker for containerization.

## Table of Contents

1. [Project Overview](#project-overview)
2. [Technology Stack](#technology-stack)
3. [Getting Started](#getting-started)
4. [API Endpoints](#api-endpoints)
5. [Database Schema](#database-schema)
6. [Docker Configuration](#docker-configuration)
7. [Code Structure](#code-structure)
8. [Testing](#testing)
9. [Deployment](#deployment)
10. [Contributing](#contributing)
11. [License](#license)

## Project Overview

This RESTful API project provides a scalable and maintainable backend service. It uses Go for its performance and concurrency capabilities, PostgreSQL for robust database operations, and Docker for easy deployment and containerization.

## Technology Stack

- Backend Language: Golang
- Database: PostgreSQL
- Containerization: Docker

## Getting Started

To run the project locally:

1. Clone the repository:

2. Build the Docker image:

3. Run the Docker container:

Your API should now be accessible at http://localhost:8080.

## API Endpoints

The API currently supports the following endpoints:

- GET /users: Retrieve all users
- POST /users: Create a new user
- GET /users/{id}: Get a specific user by ID
- PUT /users/{id}: Update a user
- DELETE /users/{id}: Delete a user

Detailed documentation for each endpoint can be found in the `api` package.

## Database Schema

The database schema is defined in the `migrations` folder. It includes tables for users and potentially other entities as the project grows.

## Docker Configuration

Docker configuration files are located in the `docker` folder. They define the environment for both development and production setups.

## Code Structure

The project follows a clean architecture pattern:

- `cmd`: Contains the main application entry point
- `internal`: Houses internal packages and logic
- `app`: Application-specific business logic
- `domain`: Domain models and interfaces
- `infrastructure`: External dependencies (database, etc.)
- `interfaces`: API handlers and middleware
- `pkg`: Reusable packages across multiple projects
- `tests`: Unit tests and integration tests

## Testing

Unit tests are implemented using Go's built-in testing package. Integration tests are also included to verify the functionality of the API endpoints.

Run tests with:

## Deployment

The project is designed to be easily deployable using Docker. For production deployment, consider using orchestration tools like Kubernetes.

## Contributing

Contributions are welcome! Please submit pull requests with clear explanations of changes made.

## License

This project is licensed under the MIT License. See LICENSE.md for details.