Categorygithub.com/mujeebcodes/go-social
module
0.0.0-20250119164658-b57f527b1907
Repository: https://github.com/mujeebcodes/go-social.git
Documentation: pkg.go.dev

# README

GoSocial API

GoSocial is a robust and scalable social media API built with Go (Golang). It provides backend services and functionalities required for building a modern social media platform, including user authentication, posts, comments, likes, and more.


Features

  • User Authentication:

    • Register, log in, and log out.
    • Password encryption and secure session management.
  • Posts and Media:

    • Create, edit, and delete posts.
    • Upload and manage images/videos for posts.
  • Engagement:

    • Like and comment on posts.
    • Follow/unfollow users.
  • Notifications:

    • Real-time notifications for likes, comments, and follows.
  • Search and Discover:

    • Search for users and hashtags.
    • Trending posts and popular hashtags.
  • Security:

    • Token-based authentication with JWT.
    • Rate limiting to prevent abuse.

Getting Started

Prerequisites

  • Go 1.20+ installed
  • PostgreSQL database (or your preferred database system)
  • Redis (for caching and real-time notifications)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/go-social.git
    cd go-social
    
  2. Install dependencies:

    go mod tidy
    
  3. Set up environment variables. Create a .env file in the project root:

    DATABASE_URL=postgres://username:password@localhost:5432/gosocial
    REDIS_URL=localhost:6379
    JWT_SECRET=your_jwt_secret
    
  4. Run database migrations:

    go run cmd/migrate/main.go
    
  5. Start the server:

    go run cmd/api/main.go
    

API Endpoints

Authentication

MethodEndpointDescription
POST/auth/registerRegister a new user
POST/auth/loginLog in a user
POST/auth/logoutLog out a user

Posts

MethodEndpointDescription
GET/postsGet all posts
POST/postsCreate a new post
PUT/posts/:idEdit a post
DELETE/posts/:idDelete a post

Comments

MethodEndpointDescription
POST/posts/:id/commentsAdd a comment to a post
GET/posts/:id/commentsGet comments for a post

Likes

MethodEndpointDescription
POST/posts/:id/likesLike a post
DELETE/posts/:id/likesUnlike a post

Users

MethodEndpointDescription
GET/users/:idGet user profile
PUT/users/:idUpdate user profile
POST/users/:id/followFollow a user
DELETE/users/:id/followUnfollow a user

Technologies Used

  • Backend Framework: Go (Golang)
  • Database: PostgreSQL
  • Caching: Redis
  • Authentication: JWT (JSON Web Tokens)
  • Testing: Go's built-in testing package
  • API Documentation: Swagger/OpenAPI

Contributing

We welcome contributions! To get started:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature-name).
  3. Commit your changes (git commit -m "Add feature").
  4. Push to the branch (git push origin feature-name).
  5. Open a Pull Request.

# Packages

No description provided by the author
Package docs Code generated by swaggo/swag.