create-argo-app

command module
v0.0.0-...-8d417d8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 8 Imported by: 0

README

Argo: A Powerful, Opinionated Web Framework for Go

Argo is a modern, powerful, and opinionated web framework for Go, designed to streamline the development of scalable and maintainable server applications. Inspired by the principles of efficiency, organization, and developer happiness, Argo offers a suite of features and tools that make it easier for teams to deliver exceptional software with ease.

Why the Name "Argo"? ⛵

1. AR + Go

The name combines "AR" (AR Data Tech) with "Go", the language it’s built on. This reflects both its foundation and its purpose: a clean, efficient framework built on Go's strengths to help developers build better applications.

2. The Legendary Ship

In Greek mythology, Argo was the ship that carried Jason and his crew on an epic journey to find the Golden Fleece. Just like the ship, this framework is designed to help developers navigate the challenges of web development and deliver something great.

So, Argo is all about building with Go, keeping things structured, and helping you "sail" through development smoothly!

Core Features

1. Developer-Friendly CLI

Argo's command-line interface (CLI) is at the heart of the framework, providing intuitive commands to help developers generate and manage projects. The CLI supports:

  • Project scaffolding: Quickly generate new server applications with pre-configured settings.
  • Boilerplate generation: Easily create controllers, models, migrations, and seeders.
  • Environment management: Built-in support for environment-specific configurations.
2. Built-In Database Management

Argo simplifies database management with:

  • Models: Define database models with struct tags for easy mapping.
  • Migrations: Automatically generate and manage database schema changes.
  • Seeders: Populate the database with initial or testing data.
3. Modular Architecture

Argo enforces a modular structure to keep projects organized and maintainable.

4. Built-In Routing

With support for route groups, middleware, and named routes, Argo makes defining and managing application routes straightforward.

5. Middleware Support

Easily integrate middleware for features like authentication, logging, or request validation. Argo provides default middleware but allows custom implementation for specific needs.

6. Efficient ORM

Argo integrates with GORM, providing a powerful and intuitive ORM for interacting with databases.

7. Dependency Injection

Built-in support for dependency injection (DI) makes it easier to manage application components and services.

8. Testing Utilities

Argo provides utilities to simplify writing unit tests, integration tests, and end-to-end tests.

Getting Started

Install Argo
# Install the CLI tool
go install github.com/ardata-tech/create-argo-app@latest
Create a New Project
# Scaffold a new project
create-argo-app new myproject

# Navigate to the project directory
cd myproject
Generate Resources
# Generate a new controller
argo make:controller user

# Generate a new model
argo make:model user

# Generate a new migration
argo make:migration users

# Generate a new seeder
argo make:seeder user
Run the Application
# Start the development server
argo serve

Example: User Management Module

Define a Model

File: models/user.go

package models

type User struct {
    ID        uint   `gorm:"primaryKey"`
    Name      string `gorm:"size:255"`
    Email     string `gorm:"unique;size:255"`
    CreatedAt time.Time
    UpdatedAt time.Time
}
Create a Migration

File: migrations/users.go

package migrations

import "gorm.io/gorm"

func Up(db *gorm.DB) error {
    return db.AutoMigrate(&models.User{})
}

func Down(db *gorm.DB) error {
    return db.Migrator().DropTable("users")
}
Implement a Controller

File: controllers/user.go

package controllers

import (
    "net/http"
    "github.com/labstack/echo/v4"
    "myproject/models"
    "gorm.io/gorm"
)

func GetUsers(c echo.Context) error {
    var users []models.User
    if err := models.DB.Find(&users).Error; err != nil {
        return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()})
    }
    return c.JSON(http.StatusOK, users)
}
Add a Route

File: routes/web.go

package routes

import (
    "github.com/labstack/echo/v4"
    "myproject/controllers"
)

func RegisterRoutes(e *echo.Echo) {
    e.GET("/users", controllers.GetUsers)
}
Run the Application
# Start the development server
argo serve

Roadmap

Planned Features
  • Plugin System: Extend the functionality of Argo with custom plugins.
  • REST and GraphQL API Support: Built-in tools for API development.
  • WebSocket Integration: Easy setup for real-time features.
  • Code Generators: Advanced generators for common patterns like services and repositories.
  • Performance Monitoring: Built-in support for monitoring and profiling applications.
Community and Contributions

Contributions are welcome! Join the community on GitHub to suggest features, report bugs, and collaborate on improving Argo..


With Argo, server development in Go has never been this efficient. Start building your next project today and experience the power of simplicity and scalability.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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