corego

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 3 Imported by: 0

README ΒΆ

CoreGo

A comprehensive backend framework for Go that provides production-ready authentication, multi-database support, and environment management through a unified API. Framework-agnostic and built for developer experience.

image search api

Features

  • πŸ” Authentication System: Built-in JWT authentication with user management
  • πŸ’Ύ Multi-Database Support: Currently supports MongoDB (PostgreSQL, MySQL coming soon)
  • 🎯 Framework Agnostic: Works with any Go web framework (Gin, Echo, Fiber, etc.)
  • βš™οΈ Environment Management: Seamless .env file integration
  • πŸ”Œ Modular Design: Use only what you need
  • πŸš€ Production Ready: Battle-tested components for real-world applications

πŸ“₯ Installation

go get github.com/berkkaradalan/CoreGo

πŸš€ Quick Start

package main

import (
    "github.com/berkkaradalan/CoreGo"
    "github.com/berkkaradalan/CoreGo/auth"
)

func main() {
    // Initialize CoreGo with your preferred database
    core, err := corego.New(&corego.Config{
        Auth: &auth.Config{
            Secret:       "your-jwt-secret",
            TokenExpiry:  60,
            DatabaseName: "users",
        },
    })
    if err != nil {
        panic(err)
    }
    defer core.Close()

    // Your application logic here
}

πŸ“¦ Core Modules

πŸ” Authentication

Full-featured authentication system with JWT tokens, user management, and customizable user data.

// Signup
user, token, err := core.Auth.Signup(auth.SignupRequest{
    Email:    "user@example.com",
    Password: "password",
    Custom:   map[string]any{"name": "John"},
})

// Login
user, token, err := core.Auth.Login(auth.LoginRequest{
    Email:    "user@example.com",
    Password: "password",
})
πŸ’Ύ Database

Unified database interface supporting multiple database systems.

Currently Supported:

  • βœ… MongoDB

Coming Soon:

  • πŸ”œ PostgreSQL
  • πŸ”œ MySQL
// Works the same across all database types
id, err := core.Mongo.InsertOne("collection", document)
results, err := core.Mongo.Find("collection", filter)
βš™οΈ Environment Variables

Automatic .env file loading with type-safe access.

MONGODB_CONNECTION_URL=mongodb://localhost:27017
AUTH_SECRET=your-secret-key
PORT=8080
core.Env.MONGODB_CONNECTION_URL  // Automatically loaded

πŸ”Œ Framework Integration

CoreGo is designed to work seamlessly with any Go web framework:

  • 🍸 Gin - Example with Gin Web Framework
  • 🎡 Echo - Coming soon
  • ⚑ Fiber - Coming soon
  • 🦁 Chi - Coming soon

πŸ“š Documentation

⚑ Configuration

CoreGo uses a simple configuration structure:

type Config struct {
    Mongo *database.MongoConfig  // Database configuration
    Auth  *auth.Config            // Authentication configuration
}

✨ Auto-configuration from environment variables:

  • βœ… If MONGODB_CONNECTION_URL is set, MongoDB connects automatically
  • βœ… No manual configuration needed for basic setup

πŸ“ Project Structure

CoreGo/
β”œβ”€β”€ auth/           # Authentication module
β”œβ”€β”€ database/       # Database adapters
β”œβ”€β”€ env/            # Environment management
β”œβ”€β”€ docs/           # Documentation
└── test/           # Examples and tests

πŸ”’ Security

  • πŸ” Passwords hashed with bcrypt
  • 🎫 JWT tokens with configurable expiry
  • πŸ”‘ Environment-based secrets
  • βœ… Secure by default

πŸ’‘ Examples

Check out the test/main.go for a complete working example with:

  • βœ… Full authentication flow
  • πŸ”’ Protected routes
  • πŸ’Ύ Database operations
  • πŸ‘€ Custom user data

Run the example:

cd test
go run main.go

πŸ—ΊοΈ Roadmap

  • MongoDB support
  • JWT authentication
  • User management
  • PostgreSQL support
  • MySQL support
  • Redis caching
  • Role-based access control (RBAC)
  • OAuth providers
  • Session management

🀝 Contributing

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

πŸ“„ License

MIT License - see LICENSE for details

πŸ‘¨β€πŸ’» Author

Berk Karadalan - GitHub

πŸ’¬ Support

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

This section is empty.

Types ΒΆ

type Config ΒΆ

type Config struct {
	Mongo *database.MongoConfig
	Auth  *auth.Config
}

type Core ΒΆ

type Core struct {
	Env   *env.Env
	Mongo *database.MongoDB
	Auth  *auth.Manager
}

func New ΒΆ

func New(config *Config) (*Core, error)

func (*Core) Close ΒΆ

func (c *Core) Close() error

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL