https://github.com/vonderklaas/social-network
A social networking backend built with Go. It features RESTful APIs for managing users, posts, and comments. It includes a modular structure, PostgreSQL, Docker, Redis, hot reloading, and more.
https://github.com/vonderklaas/social-network
docker go go-chi golang postgresql
Last synced: 11 months ago
JSON representation
A social networking backend built with Go. It features RESTful APIs for managing users, posts, and comments. It includes a modular structure, PostgreSQL, Docker, Redis, hot reloading, and more.
- Host: GitHub
- URL: https://github.com/vonderklaas/social-network
- Owner: vonderklaas
- Created: 2023-05-05T06:14:32.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-07-20T09:39:52.000Z (11 months ago)
- Last Synced: 2025-07-20T11:29:15.098Z (11 months ago)
- Topics: docker, go, go-chi, golang, postgresql
- Language: Go
- Homepage:
- Size: 63.5 MB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Folder Structure
`/bin`: compiled binaries (e.g., `air`, build artifacts)
`/cmd/api`: main HTTP API server (entrypoint and route handlers)
`/cmd/migrate`: Database migration SQL files and seed logic
`/docs`: project documentation (designs, API specs, notes)
`/internal/db`: db connection utilities and seeding helpers
`/internal/env`: environment variable configuration and helpers
`/internal/store`: storage layer: database access logic for posts, users, etc.
`/scripts`: supporting SQL and shell scripts
### Order of Development
1. Project Architecture:
- Set Up Development Environment
- Clean Layered Architecture
2. Scaffolding API Server:
- Set Up HTTP Server and API: net/http, go-chi
- Add Hot Reloading: air
- Environment Variables: direnv
3. Databases:
- Repository Pattern
- Running PostgreSQL container on Docker
- Configuring the DB Connection Pool
- Persisting Data
- SQL Migrations
4. Posts CRUD:
- Marshalling JSON
- Creating a Post
- Getting a Post by ID
- Internal Errors Package
- HTTP Payload Validation: go-validator
- DB Relationships
- SQL Joins
- Adding Comments to Posts
- Updating Posts: PATCH
- Deleting Posts
- Standardising JSON Responses
- Optimistic Concurrency Control
- Managing SQL Query Timeouts
- Database Seeding
5. The User Feed:
- Creating User Profile
- Get User By ID
- Add Followers Table
- SQL Indexes
- User Feed Algorithm
6. Filtering, Sorting, and Pagination:
- Pagination
- Sorting
- Fuzzy Search
7. Swagger
- API Docs
- Documented Routes
8. Logging
- Adding Structured Logging