A RESTful API built with Go, Gin, and MongoDB that lets developers create profiles and manage all their social links from a single place.
- Features
- Tech Stack
- Project Structure
- Getting Started
- Environment Variables
- API Endpoints
- Example Response
- Author
- Create developer profiles
- Fetch all profiles
- Fetch profile by username
- Update profile details
- Delete profiles
- Add social links
- Get all profile links
- Update existing links
- Delete links
| Technology | Purpose |
|---|---|
| Go | Backend Language |
| Gin | HTTP Framework |
| MongoDB | Database |
| Air | Live Reload |
| Godotenv | Environment Variable Management |
devlinks-api/
├── cmd/
│ └── api/
│ └── main.go
│
├── internal/
│ ├── config/
│ ├── database/
│ ├── handler/
│ ├── models/
│ ├── repository/
│ └── server/
│
├── .air.toml
├── .env
├── go.mod
├── go.sum
└── README.md
git clone https://github.com/artistic-programmer/devlinks-api.git
cd devlinks-apigo mod tidyCreate a .env file.
MONGO_URI=mongodb://localhost:27017
MONGO_DB_NAME=devlinks
PORT=8080Ensure MongoDB is running locally.
With Air:
airWithout Air:
go run ./cmd/apiThe API will be available at
http://localhost:8080
| Method | Endpoint |
|---|---|
| POST | /profiles |
| GET | /profiles |
| GET | /profiles/:username |
| PATCH | /profiles/:username |
| DELETE | /profiles/:username |
| Method | Endpoint |
|---|---|
| POST | /profiles/:username/links |
| GET | /profiles/:username/links |
| PATCH | /profiles/:username/links/:linkID |
| DELETE | /profiles/:username/links/:linkID |
{
"id": "6867f9f58f4d4f93e6d3f001",
"username": "anshu",
"bio": "Backend Developer",
"links": [
{
"id": "6867fa1c8f4d4f93e6d3f002",
"platform": "github",
"url": "https://github.com/artistic-programmer"
}
]
}Made with ❤️ by Artistic Programmer
If you found this project useful, consider giving it a ⭐ on GitHub.