Skip to content

farseer-go all components of the base module, module launcher, framework initialization program(所有组件的基础模块,模块启动器,框架初始化程序)

License

farseer-go/fs

Repository files navigation

Overview

stars license go-version release Build codecov badge

Introduction

A modular and complete infrastructure framework based on Golang,create modern web applications and APIs

Use the most popular components available today and provide them with modular technology.

The framework perfectly supports DDD domain-driven tactical design, such as warehousing repository , application-layer transactions, domain events, application-layer dynamic WebAPI.

It has a mature version of .net core that has been in use for over 10 years and is great

Don't worry about the framework making you depend on too many packages, farseer-go's components are all separate packages and unused packages are not downloaded into your application

Features

  • Unified configuration: all configurations are consolidated into . /farseer.yaml

  • Elegant: all modules follow the principle of developer experience first.

  • Modularity: provides a complete modular system that allows you to develop reusable application modules.

  • Domain-driven: helps you implement a hierarchical architecture based on DDD and build a maintainable code base.

  • link tracking : if you use the framework Orm, Redis, Http, Grpc, ES, MQ, EventBus, Task, fSchedule, will implicitly implement link tracking for you and provide API request logs, slow queries.

Combined with FOPS project (automatic build, link tracing console, K8S cluster log collection) support code non-intrusive full link real-time monitoring.

Components

Package Name Description
fs Basic Core Package go-versionreleaseBuildcodecovbadge
collections Data Collection go-versionreleaseBuildcodecovbadge
webapi web api go-versionreleaseBuildcodecovbadge
async Async Programming go-versionreleaseBuildcodecovbadge
mapper Object Conversion go-versionreleaseBuildcodecovbadge
cacheMemory Local Cache go-versionreleaseBuildcodecovbadge
redis client go-versionreleaseBuildcodecovbadge
data DataBase ORM go-versionreleaseBuildcodecovbadge
elasticSearch client go-versionreleaseBuildcodecovbadge
eventBus eventBus go-versionreleaseBuildcodecovbadge
queue Local Queue go-versionreleaseBuildcodecovbadge
tasks Local tasks go-versionreleaseBuildcodecovbadge
fSchedule client go-versionreleaseBuildcodecovbadge
utils utils go-versionreleaseBuildcodecovbadge
rabbit rabbit client go-versionreleaseBuildcodecovbadge
etcd etcd client go-versionreleaseBuildcodecovbadge
linkTrace linkTrace go-versionreleaseBuildcodecovbadge
redisStream redis mq Coming soon

Quick Start

main.go

package main
import "github.com/farseer-go/fs"
import "github.com/farseer-go/fs/modules"
import "github.com/farseer-go/webapi"

func main() {
  fs.Initialize[StartupModule]("your project Name")
}

type StartupModule struct { }

func (module StartupModule) DependsModule() []modules.FarseerModule {
  return []modules.FarseerModule{webapi.Module{}}
}
func (module StartupModule) PreInitialize() { }
func (module StartupModule) Initialize() { }
func (module StartupModule) PostInitialize() { }
func (module StartupModule) Shutdown() { }

In the first line of the main function, execute fs.Initialize to start initializing the framework

After running the console prints the loading message.

2023-01-05 16:15:00 AppName:  your project Name
2023-01-05 16:15:00 AppID:    199530571963039744
2023-01-05 16:15:00 AppIP:    192.168.3.55
2023-01-05 16:15:00 HostName: stedenMacBook-Pro.local
2023-01-05 16:15:00 HostTime: 2023-01-05 16:15:00
2023-01-05 16:15:00 PID:      22131

2023-01-05 16:15:00 ---------------------------------------
2023-01-05 16:15:00 Loading Module...
2023-01-05 16:15:00 Loading Module:webapi.Module
2023-01-05 16:15:00 Loading Module:main.StartupModule
2023-01-05 16:15:00 Loaded, 11 modules in total
2023-01-05 16:15:00 ---------------------------------------
2023-01-05 16:15:00 Elapsed time:0 ms modules.FarseerKernelModule.PreInitialize()
2023-01-05 16:15:00 Elapsed time:0 ms webapi.Module.PreInitialize()
2023-01-05 16:15:00 Elapsed time:0 ms main.StartupModule.PreInitialize()
2023-01-05 16:15:00 ---------------------------------------
2023-01-05 16:15:00 Elapsed time:0 ms modules.FarseerKernelModule.Initialize()
2023-01-05 16:15:00 Elapsed time:0 ms webapi.Module.Initialize()
2023-01-05 16:15:00 Elapsed time:0 ms main.StartupModule.Initialize()
2023-01-05 16:15:00 ---------------------------------------
2023-01-05 16:15:00 Elapsed time:0 ms modules.FarseerKernelModule.PostInitialize()
2023-01-05 16:15:00 Elapsed time:0 ms webapi.Module.PostInitialize()
2023-01-05 16:15:00 Elapsed time:0 ms main.StartupModule.PostInitialize()
2023-01-05 16:15:00 ---------------------------------------
2023-01-05 16:15:00 Initialization completed, total time:0 ms 
2023-01-05 16:15:00 [Info] Web service is started:http://localhost:8888/

farseer-go framework demo

We have provided simulations of a small e-commerce website using the following techniques.

  • ddd: using domain-driven design
  • ioc: use ioc/container, do decoupling, injection, dependency inversion
  • webapi: api service, and use dynamic api technology
  • data: database operations
  • redis: redis operation
  • eventBus: event driver You can download it locally and run it

Stargazers

Stargazers repo roster for @farseer-go/fs

About

farseer-go all components of the base module, module launcher, framework initialization program(所有组件的基础模块,模块启动器,框架初始化程序)

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages