https://github.com/clebsf/go-finance
A simple Go-based API for tracking and managing personal expenses. This CRUD application allows users to create, read, update, and delete expense records. It’s designed with clean architecture principles, utilizing Go modules for dependency management.
https://github.com/clebsf/go-finance
crud-api go golang
Last synced: 13 days ago
JSON representation
A simple Go-based API for tracking and managing personal expenses. This CRUD application allows users to create, read, update, and delete expense records. It’s designed with clean architecture principles, utilizing Go modules for dependency management.
- Host: GitHub
- URL: https://github.com/clebsf/go-finance
- Owner: clebsf
- Created: 2024-03-23T12:47:56.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-24T17:55:46.000Z (about 2 years ago)
- Last Synced: 2025-03-03T00:17:40.201Z (over 1 year ago)
- Topics: crud-api, go, golang
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go Finance API
This is a simple API for managing personal finances, focusing on expense tracking.
## Getting Started
### Prerequisites
Ensure you have the following installed:
- Go (version 1.22.1 or later)
- Any necessary environment variables or additional setup specified in `go.mod`.
### Installation
1. Clone the repository to your local machine:
```sh
git clone https://github.com/yourusername/go-finance.git
```
2. Navigate to the cloned repository:
```sh
cd go-finance
```
3. To start the server, run the `main.go` file located in the `cmd/api-server` directory:
```sh
go run cmd/api-server/main.go
```
The server will start on port 3000 by default.
## Endpoints
### Expense Management
- **Create a new expense:**
`POST /v1/expenses`
Request body should include:
- `amount`: The amount of the expense (a number).
- `description`: A brief description of the expense (a string).
- `category`: The category for the expense (a string).
Example request in `create_expense.http`.
- **Update an existing expense:**
`PUT /v1/expenses/{id}`
Request body should include the same properties as the create endpoint.
Example request in `update_expense.http`.
- **Delete an expense:**
`DELETE /v1/expenses/{id}`
Example request in `delete_expense.http`.
- **List all expenses:**
`GET /v1/expenses`
Example request in `list_expense.http`.
- **Get a specific expense:**
`GET /v1/expenses/{id}`
Example request in `get_expense.http`.
## Project Structure
- `cmd/api-server/main.go`: The entry point of the application.
- `cmd/api-server/handler/expense.go`: The HTTP handlers for the expense-related endpoints.
- `internal/model/expense.go`: The data model for an expense entity.
- `script/`: Directory containing example HTTP requests for API endpoints.
## Dependencies
This project uses Go modules for dependency management. The list of dependencies is defined in the `go.mod` file.