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

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.

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