A powerful CRUD system for configuration management with JWT authentication and access token support, built in Go with MongoDB and Ristretto cache. Features a cyberpunk-themed web interface with OpenBMC Web UI Style Guide compliance.
- π Dual Authentication: JWT for user auth + Access tokens for API integration
- π Complete Configuration CRUD: Create, read, update, delete settings
- π― Access Token Management: Generate tokens for external applications
- π Ristretto Cache: High-performance in-memory caching with automatic invalidation
- π Public API: Token-based endpoints for external consumption
- π¨ Cyberpunk UI: Modern responsive interface with Vice City theme
- π MongoDB Database: Reliable document storage
- π³ Docker Ready: Containerized with distroless image
- π Toast Notifications: OpenBMC compliant notification system
- ποΈ Toggle Controls: Enable/disable settings and tokens
- Backend: Go (Gin framework)
- Database: MongoDB
- Cache: Ristretto (In-memory)
- Authentication: JWT + Access Tokens
- Frontend: HTML5, CSS3, JavaScript (Cyberpunk theme)
- UI Framework: OpenBMC Web UI Style Guide
- Containerization: Docker & Docker Compose
- Middleware: Custom authentication & logging
- Clone the repository:
git clone https://github.com/MartinezAvellan/confy.git
cd confy
- Run with Docker Compose:
docker-compose up --build
- Access the application at
http://localhost:8080
-
Make sure you have Go 1.24+ and MongoDB installed
-
Configure environment variables:
cp .env.example .env
# Edit the .env file as needed
- Install dependencies:
go mod tidy
- Run the application:
go run main.go
- Go to
/register
- Fill in username, email and password
- Click "Register"
- Go to
/login
- Use your credentials to login
- You will be redirected to the dashboard
- In the dashboard, you can:
- Create new settings with environment support
- Edit existing configurations inline
- Delete configurations (with double-click confirmation)
- Toggle enable/disable settings
- View all your configurations with search/filter
- Generate access tokens for external applications
- Manage token permissions and status
- Use tokens to access public API endpoints
- Use the Postman collection for easy API testing
- Integrate with external applications using access tokens
- Access settings via public API endpoints
POST /api/register
- Register new userPOST /api/login
- User login (returns JWT token)
POST /api/settings
- Create configurationGET /api/settings
- List all configurationsGET /api/settings/:id
- Get specific configurationPUT /api/settings/:id
- Update configurationPATCH /api/settings/:id/toggle
- Toggle enable/disableDELETE /api/settings/:id
- Delete configuration
POST /api/tokens
- Create access tokenGET /api/tokens
- List all tokensPUT /api/tokens/:id
- Update tokenPATCH /api/tokens/:id/toggle
- Toggle enable/disableDELETE /api/tokens/:id
- Delete token
GET /api/public/settings
- Get settings (key-value format)- Query params:
?environment=dev&key=database_url
- Query params:
GET /api/public/settings/all
- Get all settings (full objects)- Query params:
?environment=dev&key=database_url
- Query params:
GET /api/public/settings/:id
- Get specific setting by ID
We provide a comprehensive Postman collection for easy API testing and integration:
π Location: /postman/Confy_API_Collection.json
- β All endpoints included with example requests
- β Auto-token management - JWT and access tokens saved automatically
- β Environment variables - Configurable base URL and IDs
- β Complete workflow - From registration to API consumption
- β Detailed documentation - Step-by-step usage guide
- Import
postman/Confy_API_Collection.json
into Postman - Follow the requests in order: Register β Login β Create Token β Use APIs
- Tokens are automatically saved and used in subsequent requests
π Read the complete Postman guide for detailed instructions.
confy/
βββ config/ # Configurations (DB, Cache, Environment)
βββ handlers/ # HTTP Handlers (Auth, Settings, Tokens)
βββ middleware/ # Middlewares (Auth, Token Auth, Logger)
βββ models/ # Data Models (User, Setting, Token)
βββ templates/ # Frontend Templates
β βββ css/ # Cyberpunk theme styles
β βββ js/ # JavaScript functionality
β βββ *.html # HTML templates
βββ postman/ # API Testing Collection
β βββ Confy_API_Collection.json
β βββ README.md # Postman guide
βββ main.go # Application entry point
βββ Dockerfile # Docker configuration
βββ docker-compose.yml
βββ CONTRIBUTING.md # Contribution guidelines
βββ README.md # This file
Variable | Description | Default |
---|---|---|
MONGO_URI |
MongoDB connection URI | mongodb://localhost:27017 |
DB_NAME |
Database name | confy |
JWT_SECRET |
JWT secret key | your-secret-key |
JWT_EXPIRATION_HOURS |
JWT token expiration time | 24 |
CACHE_TTL_MINUTES |
Cache TTL in minutes | 5 |
SERVER_PORT |
Server port | 8080 |
GIN_MODE |
Gin mode (debug/release) | debug |
The system uses Ristretto for high-performance in-memory caching:
- Per-user setting cache with automatic invalidation
- Public API cache with application-specific keys
- Configurable TTL (default: 5 minutes)
- Pattern-based invalidation for related cache entries
- Optimized queries to reduce database load
The project implements several security practices:
- Dual Authentication: JWT for users + Access tokens for APIs
- Distroless Image: Final container without shell, package managers or unnecessary binaries
- Non-root User: Application runs with
nonroot
user - Password Hashing: Bcrypt for secure password hashing
- Input Validation: Strict validation of all input data
- Token-based Access: Secure API access with revocable tokens
- User Isolation: Users can only access their own settings
- Cache Security: User-specific cache keys prevent data leakage
We welcome contributions from the community! Please read our Contributing Guide for details on:
- π Reporting bugs
- π‘ Requesting features
- π§ Submitting code changes
- π Improving documentation
# Clone the repository
git clone https://github.com/MartinezAvellan/confy.git
cd confy
# Set up development environment
make dev-setup
# Start development server
make up
The modern web interface includes:
- Color Palette: Neon blues (#00a8ff), pinks (#f4afc2), purples (#b28bc0)
- Dark Gradient Background: Professional cyberpunk aesthetic
- Glowing Effects: Text shadows and box shadows for depth
- Responsive Design: Works seamlessly on desktop and mobile
- Toast Notifications: Auto-dismiss success (10s), manual dismiss for errors
- Consistent Typography: Sans-serif fonts throughout
- Proper Spacing: 8px/0.5rem grid system
- Interactive Elements: Hover effects and smooth transitions
- Toggle Switches: Visual enable/disable controls
- Double-click Confirmation: Prevents accidental deletions
- Modal Centering: Perfect positioning for all screen sizes
- Disabled State Handling: Clear visual feedback for inactive items
- Loading States: Smooth transitions and feedback
If you find Confy useful, consider supporting the development:
β Star this repository - Help others discover Confy! π Report issues - Help improve the project π‘ Suggest features - Share your ideas π§ Contribute code - Join the development
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with β€οΈ using Go, MongoDB, and modern web technologies
- Thanks to all contributors who help make Confy better!