Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Spin up a chat server for your friends&family in seconds! Passwordless (nostr keys) but empasis on usability for noobs.

Notifications You must be signed in to change notification settings

EwenQuim/microchat

Repository files navigation

MicroChat

A real-time chat application built with Go (Fuego) backend and a modern frontend.

Project Structure

microchat/
├── app/                    # Frontend application
├── cmd/                    # Application entry points
│   ├── server/            # API server
│   └── cli/               # CLI tool
├── internal/              # Private application code
│   ├── handlers/          # HTTP request handlers
│   ├── models/            # Data models
│   ├── services/          # Business logic
│   ├── repository/        # Data storage
│   ├── middleware/        # HTTP middleware
│   └── config/            # Configuration
├── pkg/                   # Public packages
│   └── client/            # API client library
├── static/                # Built frontend files (served by API)
├── scripts/               # Build and deployment scripts
├── Dockerfile             # Docker configuration
├── docker-compose.yml     # Docker Compose configuration
└── Makefile              # Build automation

Getting Started

Prerequisites

  • Go 1.23+
  • Node.js 20+
  • Docker (optional)

Installation

  1. Install dependencies:
make install
  1. Copy environment variables:
cp .env.example .env

Development

Run in development mode (frontend dev server + Go server):

make dev

Production Build

Build everything:

make build

Run the server:

make run

Or build and run specific components:

make build-frontend
make build-server
make build-cli

Docker Deployment

Using Pre-built Image (GitHub Container Registry)

Pull and run the latest image:

docker pull ghcr.io/ewenquim/microchat:latest
docker run -p 8080:8080 ghcr.io/ewenquim/microchat:latest

Building Locally

Build Docker image:

make docker-build

Run with docker-compose:

make docker-up

Stop:

make docker-down

CLI Usage

The CLI tool allows you to interact with the chat API from the command line.

Send a message:

./bin/cli -cmd send -room general -user john -message "Hello, world!"

List messages in a room:

./bin/cli -cmd list -room general

List all rooms:

./bin/cli -cmd rooms

API Endpoints

  • GET /api/rooms - List all chat rooms
  • GET /api/rooms/:room/messages - Get messages from a room
  • POST /api/rooms/:room/messages - Send a message to a room

Environment Variables

  • PORT - Server port (default: 8080)
  • ENV - Environment (development/production)

CI/CD

The project includes GitHub Actions workflows for:

  • CI (ci.yml): Runs on PRs and pushes

    • Tests Go code (server & CLI)
    • Builds frontend
    • Runs with race detection and coverage
  • Lint (lint.yml): Go code linting with golangci-lint

    • Strict on PRs (blocks merge on issues)
    • Warnings only on main/master
  • Docker Publish (docker-publish.yml): Builds and pushes to GHCR

    • Triggers on push to main/master or version tags
    • Automatic tagging: latest, v1.0.0, v1.0, v1
    • Published to: ghcr.io/ewenquim/microchat

Releasing

To create a new release:

git tag v1.0.0
git push origin v1.0.0

This will automatically build and push the Docker image with version tags.

Clean Up

Remove build artifacts:

make clean

About

Spin up a chat server for your friends&family in seconds! Passwordless (nostr keys) but empasis on usability for noobs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages