CoreGo Framework

CoreGo Framework

You know that feeling when you start a new Go project and think, "Ugh, here we go again with authentication..."? Yeah, me too. That's exactly why I built CoreGo.

CoreGo Banner

Photo by @cookiethepom on Unsplash

The Problem That Kept Bugging Me

Look, I love Go. The simplicity, the performance, the clean syntax—it's all great. But here's what was driving me crazy: every single time I started a new project, I found myself copy-pasting the same authentication code, rewriting database connection logic, and setting up environment variables for the hundredth time.

I'd sit there thinking, "There has to be a better way." So I started building one.

What CoreGo Actually Does

CoreGo is basically all the boring stuff you need in a backend, packaged up so you don't have to think about it anymore. Think of it as the foundation that lets you jump straight to the fun parts of your project.

Here's what it handles:

  • Authentication - JWT tokens, password hashing, user management. The whole nine yards.
  • Database stuff - Right now it's MongoDB (because that's what I needed first), but PostgreSQL and MySQL are on the way.
  • Environment variables - Automatic loading, type-safe access. No more os.Getenv everywhere.

The best part? It works with whatever framework you're using. Gin? Cool. Echo? No problem. Fiber? Go for it. I didn't want to lock anyone into a specific way of doing things.

Why I Made It Framework-Agnostic

Here's the thing—I've switched frameworks before. You probably have too. Maybe you started with Gin, then tried Echo, or maybe you're curious about Fiber.

When that happens, you shouldn't have to rebuild your entire authentication system. CoreGo sits underneath all of that, so your auth, database, and config logic stays the same no matter what framework flavor you're into this week.

The "Aha!" Moment

I was working on my third or fourth side project (who's counting, right?) and realized I was literally copying the same user authentication files from my previous project. Same JWT logic, same password hashing, same everything.

That's when it clicked: what if I just made this into a proper library? Not some over-engineered enterprise monstrosity, just clean, simple tools that do exactly what you need.

How Simple Is It Really?

Dead simple. Here's all you need to get started:

go get github.com/berkkaradalan/CoreGo

Then in your code:

core, err := corego.New(&corego.Config{
    Auth: &auth.Config{
        Secret:       "your-jwt-secret",
        TokenExpiry:  60,
        DatabaseName: "users",
    },
})

That's it. You now have a complete authentication system. User registration? Check. Login? Check. Protected routes? Check.

Real Talk: What's Still Missing?

I'm not going to pretend CoreGo is perfect. There's stuff I haven't built yet because, well, I'm one person and there are only so many hours in a day.

What's coming:

  • PostgreSQL and MySQL support (lots of people have asked for this)
  • Redis caching (because every app eventually needs it)
  • Role-based access control (RBAC is on my radar)
  • OAuth providers (Google, GitHub login, etc.)
  • Better session management options

I'm building these features as I need them in my own projects, which means they'll be practical and actually useful, not just checkbox features.

A Quick Example with Gin

Since Gin is probably the most popular Go framework, here's how CoreGo fits in:

func main() {
    // Set up CoreGo
    core, _ := corego.New(&corego.Config{
        Auth: &auth.Config{
            Secret:      "jwt-secret",
            TokenExpiry: 60,
        },
    })
    defer core.Close()

    r := gin.Default()

    // Public endpoints
    r.POST("/signup", func(c *gin.Context) {
        var req auth.SignupRequest
        c.BindJSON(&req)
        user, token, err := core.Auth.Signup(req)
        if err != nil {
            c.JSON(400, gin.H{"error": err.Error()})
            return
        }
        c.JSON(200, gin.H{"user": user, "token": token})
    })

    // Protected endpoints
    protected := r.Group("/api")
    protected.Use(core.Auth.Middleware())
    {
        protected.GET("/profile", func(c *gin.Context) {
            userID := c.GetString("userID")
            c.JSON(200, gin.H{"userID": userID})
        })
    }

    r.Run(":8080")
}

Notice how the middleware just plugs in? That's the whole point. CoreGo handles the authentication logic; you handle your app logic.

Using CoreGo in Real Projects

I'm actually using CoreGo in a project I'm actively building right now—a real-time ChatApplication. It's a WebSocket-based chat system built with Go, and CoreGo handles all the authentication and user management.

Here's the thing: when you're building something with WebSockets and real-time communication, the last thing you want to worry about is whether your auth system works. CoreGo just handles it. Users can sign up, log in, and their JWT tokens work seamlessly with the WebSocket connections. I didn't have to write any of that—I just plugged in CoreGo and focused on the actual chat features.

That's exactly why I built this. When you're working on the interesting parts of your project (like real-time messaging, in my case), you shouldn't be debugging JWT token validation or worrying about password hashing. CoreGo takes care of the boring but critical stuff so you can build what matters.

Why Open Source?

I'm releasing CoreGo as open source (MIT license) for a few reasons:

  1. I want feedback. If you find bugs or have ideas, I want to hear them.
  2. Better code through collaboration. More eyes mean better code.
  3. Give back to the community. I've learned so much from open source projects; this is my way of contributing.

Plus, let's be honest, if this helps even one person avoid rewriting authentication for the millionth time, it's worth it.

What's Next?

I'm actively working on CoreGo. The roadmap isn't set in stone because I'm building based on what people actually need, not what looks good on a features list.

Here's what I'm thinking about:

  • Adding PostgreSQL/MySQL support (high priority)
  • Redis integration for caching
  • OAuth providers
  • Role-based permissions
  • Maybe some pre-built admin panels?

If you have ideas or requests, hit me up on GitHub. I'm all ears.

Try It Out

If you're tired of writing the same boilerplate code, give CoreGo a shot:

go get github.com/berkkaradalan/CoreGo

Check out the documentation and the example in the test folder. If you run into issues or have questions, open an issue or start a discussion on GitHub.

And hey, if you find it useful, star the repo. It helps more people discover it.


Links:


CoreGo is MIT licensed. Use it, fork it, improve it. Just build cool stuff.