Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ GeekHack, Reimagined

Build Status Go Version Next.js Version

A complete overhaul of a legacy forum, architected from the ground up as a modern, high-performance web application. This project uses a modular Golang backend and a server-rendered React frontend to deliver a fast, scalable, and developer-friendly experience.

✨ Key Features

  • 🎨 Modern, Responsive UI: Built with Tailwind CSS for a utility-first design that is fast and looks great on all devices
  • ⚑ Optimized for Performance & SEO: Leverages Next.js for Server-Side Rendering (SSR), ensuring fast initial page loads and excellent search engine visibility
  • πŸ›‘οΈ Robust Backend: Engineered with a modular, RESTful API in Golang using the Gin framework for high-performance routing
  • πŸ”’ Type-Safe Database Interaction: Utilizes GORM to interact with a PostgreSQL database, providing type safety and preventing common SQL injection vulnerabilities
  • πŸ” Secure Authentication: Implements a secure user registration and login system using JWT (JSON Web Tokens)

πŸ› οΈ Tech Stack

Area Technology
Frontend React, Next.js, Tailwind CSS
Backend Golang, Gin, GORM
Database PostgreSQL
Dev & Deploy Docker, Docker Compose

πŸ“ Project Structure

This project is structured as a monorepo to keep the frontend and backend code in a single, easy-to-manage repository.

geekhack-reimagined/
β”œβ”€β”€ .github/              # GitHub Actions workflows
β”œβ”€β”€ backend/              # Golang REST API
β”‚   β”œβ”€β”€ cmd/              # Main application entry point
β”‚   β”œβ”€β”€ internal/         # Private application logic (handlers, services, repos)
β”‚   β”œβ”€β”€ pkg/              # Public library code
β”‚   β”œβ”€β”€ Dockerfile        # Backend Docker image definition
β”‚   └── go.mod            # Go module dependencies
β”œβ”€β”€ frontend/             # Next.js Web Application
β”‚   β”œβ”€β”€ app/              # Next.js App Router structure
β”‚   β”œβ”€β”€ components/       # Reusable React components
β”‚   β”œβ”€β”€ lib/              # Helper functions, API clients
β”‚   β”œβ”€β”€ public/           # Static assets
β”‚   └── Dockerfile        # Frontend Docker image definition
β”œβ”€β”€ docker-compose.yml    # Local development environment setup
β”œβ”€β”€ .env.example          # Example environment variables
└── README.md             # This file

πŸš€ Getting Started

Follow these instructions to get the project up and running on your local machine for development and testing purposes.

Prerequisites

You must have the following software installed on your machine:

  • Go (v1.18+)
  • Node.js (v18+)
  • Docker & Docker Compose

Installation

Clone the repository:

git clone https://github.com/AlanKha/GeekHack-Reimagined.git
cd GeekHack-Reimagined

Configure Environment Variables:

Create a .env file in the project root by copying the example file. This file will be used by Docker Compose to configure all services.

cp .env.example .env

Now, open the .env file and fill in the values. The defaults are suitable for local development.

Build and Run with Docker Compose:

This single command will build the Docker images for the frontend and backend, start the PostgreSQL database container, and run the entire application.

docker-compose up --build

You should now be able to access:

πŸ“‹ To-Do List & Project Roadmap

This is the development plan. Check off items as they are completed.

Phase 0: Project Setup & Foundation

  • Initialize Git repository
  • Set up monorepo folder structure (frontend, backend)
  • Create initial docker-compose.yml for local development
  • Create .env.example with necessary variables (DB credentials, ports, JWT secret)
  • Write initial README.md file

Phase 1: Backend API (Golang)

  • Initialize Go module in /backend
  • Integrate Gin for routing
  • Set up GORM and establish a database connection module
  • Database Design: Define GORM models for User, Thread, and Post
  • Implement GORM AutoMigrate to create tables on startup

User Authentication

  • /register endpoint (hash password before saving)
  • /login endpoint (verify credentials, issue JWT)
  • JWT authentication middleware to protect routes

Thread Endpoints (CRUD)

  • POST /api/threads (Create, protected)
  • GET /api/threads (Read all)
  • GET /api/threads/:id (Read one)
  • PUT /api/threads/:id (Update, protected)
  • DELETE /api/threads/:id (Delete, protected)

Post Endpoints (CRUD)

  • POST /api/threads/:id/posts (Create, protected)

  • GET /api/posts/:id (Read one, likely not needed)

  • PUT /api/posts/:id (Update, protected)

  • DELETE /api/posts/:id (Delete, protected)

  • Implement robust error handling and standardized JSON responses

  • Set up basic unit tests for service logic

Phase 2: Frontend UI (Next.js)

  • Initialize Next.js project in /frontend with TypeScript and Tailwind CSS

Component Library

  • Build reusable UI components (Button, Input, Card, Navbar)
  • API Client: Create a library in /lib/api.ts to handle all fetch requests to the backend

Static Pages & Layout

  • Create main application layout with Navbar and Footer
  • Build Homepage (/) to fetch and display all threads
  • Build /login and /register pages with forms

Dynamic Pages

  • Build Thread Detail page (/thread/[id]) to fetch and display a single thread and its posts

Authentication Flow

  • Create a React Context for managing authentication state
  • On login, store JWT securely (HttpOnly cookie)
  • Create protected routes/components that are only visible to logged-in users

User Interaction

  • Build form for creating new threads
  • Build form for creating new posts/replies within a thread
  • Implement logic for updating/deleting threads and posts

Phase 3: Deployment

  • Create a production-ready Dockerfile for the Go backend (multi-stage build)
  • Create a production-ready Dockerfile for the Next.js frontend
  • Provision a managed PostgreSQL instance (e.g., AWS RDS, Google Cloud SQL)
  • Set up a container registry (e.g., Docker Hub, Google Artifact Registry)
  • Write deployment scripts/configuration for a cloud provider (e.g., cloudbuild.yaml for Google Cloud Run)
  • Deploy backend and frontend services
  • Configure DNS and secure with SSL/TLS

Phase 4: Future Features (Backlog)

  • User Profiles
  • Markdown support for posts with preview
  • Pagination for threads and posts
  • Full-text search functionality
  • Admin roles and moderation tools

πŸš€ Architecture Roadmap

  • Backend: Implement Redis for caching frequently accessed data (e.g., threads, posts) to reduce database load and improve API response times.
  • Frontend: Integrate Redux Toolkit for more robust and scalable state management, particularly for handling user authentication and caching fetched data.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Built with ❀️ using modern web technologies
  • Inspired by the original GeekHack forum community

Releases

Packages

Used by

Contributors

Languages