photon

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: MIT Imports: 0 Imported by: 2

README

Photon

Photon is a lightweight and extensible backend framework for Go. Built with a modular, adapter-based architecture, Photon enables developers to create robust HTTP applications with clarity and flexibility.


✨ Features

  • Modular Adapters: Seamlessly switch between HTTP and WebSocket backends .
  • Plug-and-Play Architecture: Easy integration of custom adapters.
  • Minimalistic Core: No hidden magic — full transparency and maintainability.

🚀 Installation

go get github.com/smtdfc/photon
go install github.com/smtdfc/photon-cli

⚙️ Getting Started

1. Create a new Echo-based Photon app
go mod init example.com/hello
photon-cli init hello_app
2. Generate a module
photon-cli gen module Hello
3. Define your module routes

In modules/hello/routes.go:

package hello

func InitRoutes() {
    self().Router.Get("/hello", handleGet)
}

In modules/hello/handlers.go:

package hello

import "github.com/smtdfc/photon/http_adapter"

func handleGet(ctx http_adapter.Context) {
    ctx.Res().JSON(http_adapter.JSON{
        "message": "Hello World 🚀",
    })
}

Register the module in your app:

package app

import (
    "github.com/smtdfc/photon/core"
    "example.com/modules/hello"
)

func InitModule(app *core.App) {
    hello.Init(app)
}
4. Run the app
photon-cli dev

Access it at: http://127.0.0.1:3000/hello

📜 License

Photon is licensed under the MIT License. © 2025 smtdfc

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cli module
cmd
photon module
dix module
http-gateway module
internal

Jump to

Keyboard shortcuts

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