Go Opportunities is a simple REST API for managing job openings. It is built with Go, Gin, GORM, and SQLite, and includes Swagger UI for interactive API documentation.
This project exposes a small CRUD API for job opportunities, allowing you to:
- create a job opening
- list all openings
- fetch a single opening by ID
- update an existing opening
- delete an opening
The application stores data in a local SQLite database at db/main.db, which is created automatically on first run.
| Layer | Technology |
|---|---|
| Language | Go |
| HTTP framework | Gin |
| ORM | GORM |
| Database | SQLite |
| API docs | Swagger / swaggo |
.
├── config/ # database and logger setup
├── db/ # SQLite database file
├── docs/ # generated Swagger documentation
├── handler/ # HTTP handlers, requests, and responses
├── router/ # route registration and server bootstrap
├── schemas/ # database models and response schemas
└── main.go # application entry point
- Go installed
- A Go version compatible with the one declared in
go.mod
git clone https://github.com/ArctisDev/go-opportunities.git
cd go-opportunities
go mod downloadgo run main.goThe server starts on:
http://localhost:8080
http://localhost:8080/api/v1
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/openings |
List all job openings |
| GET | /api/v1/opening?id={id} |
Get a single opening |
| POST | /api/v1/opening |
Create a new opening |
| PUT | /api/v1/opening?id={id} |
Update an opening |
| DELETE | /api/v1/opening?id={id} |
Delete an opening |
Example request body used for creating an opening:
{
"role": "Backend Go Developer",
"company": "Acme Inc.",
"description": "Build and maintain backend services in Go.",
"remote": true,
"location": "Sao Paulo, Brazil",
"salary": 120000,
"url": "https://example.com/jobs/backend-go-developer"
}For updates, send only the fields you want to change in the request body and provide the target opening ID in the query string.
Swagger UI is available at:
http://localhost:8080/swagger/index.html
curl -X POST http://localhost:8080/api/v1/opening \
-H "Content-Type: application/json" \
-d '{
"role": "Backend Go Developer",
"company": "Acme Inc.",
"description": "Build and maintain backend services in Go.",
"remote": true,
"location": "Sao Paulo, Brazil",
"salary": 120000,
"url": "https://example.com/jobs/backend-go-developer"
}'curl http://localhost:8080/api/v1/openingscurl "http://localhost:8080/api/v1/opening?id=1"curl -X PUT "http://localhost:8080/api/v1/opening?id=1" \
-H "Content-Type: application/json" \
-d '{
"salary": 130000,
"remote": false
}'curl -X DELETE "http://localhost:8080/api/v1/opening?id=1"- The database schema is auto-migrated when the application starts.
- The SQLite file is stored locally, which makes the project convenient for learning, prototyping, and small internal tools.