Skip to content

KunalKumar-1/Evently

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Evently - Event Management API

A Go-based event management API built with Gin, SQLite, and JWT authentication.

Prerequisites

  • Go 1.24.5 or higher
  • Air (for live reload during development)
  • SQLite3

Getting Started

1. Install Dependencies

# Using Makefile (recommended)
make install

# Or manually
go mod download

2. Environment Setup

Create a .env file in the root directory:

PORT=8080
JWT_SECRET=your-secret-key-here
DATABASE_URL=./data.db

3. Run Database Migrations

# Using Makefile
make migrate-up

# Or manually
go run cmd/migrate/main.go up

4. Run the Application

Option A: Using Air (Recommended for Development)

# Using Makefile
make dev

# Or manually
air

Option B: Using Go directly

# Using Makefile
make run

# Or manually
go run cmd/api/main.go

The API will be available at http://localhost:8080

Makefile Commands

The project includes a Makefile for common tasks. Run make help to see all available commands:

Command Description
make help Show all available commands
make install Install Go dependencies
make deps Alias for install
make migrate-up Run database migrations
make migrate-down Rollback database migrations
make dev Start development server with Air
make run Run the application
make build Build the application binary
make clean Clean build artifacts and temp files
make test Run tests

Examples

# See all available commands
make help

# Install dependencies and run migrations
make install
make migrate-up

# Start development server
make dev

# Build production binary
make build

# Run tests
make test

# Clean up
make clean

Project Structure

├── cmd/
│   ├── api/               # Main API application (Gin server)
│   │   ├── auth.go        # Authentication handlers (login, register)
│   │   ├── contex.go      # Helper functions to get user from context
│   │   ├── events.go      # Event CRUD handlers
│   │   ├── main.go        # Entry point for API server
│   │   ├── middleware.go  # Authentication & logging middleware
│   │   ├── routes.go      # Route definitions
│   │   └── server.go      # Server configuration & startup
│   └── migrate/           # Database migrations
│       └── migrations/
│           ├── 000001_create_user_table.up.sql
│           ├── 000001_create_user_table.down.sql
│           ├── 000002_create_events_table.up.sql
│           ├── 000002_create_events_table.down.sql
│           ├── 000003_create_attendance_table.up.sql
│           ├── 000003_create_attendance_table.down.sql
│           └── main.go
│
├── internals/
│   ├── database/          # Database models and queries
│   │   ├── models.go      # Model registry
│   │   ├── users.go       # User model & queries
│   │   ├── event.go       # Event model & queries
│   │   └── attendee.go    # Attendance model & queries
│   └── env/               # Environment configuration (env variables)
│       └── env.go
│
├── server/                # Server-related files (local data, configs)
│   └── data.db            # Local SQLite database
│
├── tmp/                   # Temporary build and runtime files
│   ├── main               # Compiled binary (generated by Air)
│   └── build-errors.log   # Logs from failed builds
│
├── Makefile               # Build & run automation commands
├── go.mod                 # Go module definition
├── go.sum                 # Dependency checksums
├── data.db                # Development SQLite database
├── .air.toml              # Air live-reload configuration
└── README.md              # Project documentation

API Endpoints

  • Authentication endpoints
  • Event management endpoints

Development

The project uses Air for live reload during development. Any changes to .go files will automatically rebuild and restart the server.

Use make dev to start the development server with live reload enabled.

Building for Production

# Build the binary
make build

# The binary will be created at bin/api
./bin/api

License

MIT

About

A Go-based event management API built with Gin, SQLite, and JWT Authentication.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published