Skip to main content

SPARROW CODER / ADMIN APPLICATION GENERATOR

sparrow-coder

From a PO class
to your application.

Turn your PO classes into a Clean Architecture backend and frontend pages that follow your package conventions. Templates and metadata handle the repetitive work.

  • No AI required
  • Separate frontend & backend
  • Code you can extend
model → application
Define your modelUserExample.java
PO
sparrow-coderTemplates + metadata

Generate both sides

Spring BootClean Architecture backendsparrow-example
React / Next.jsAdmin lists & formsreact-next-admin
One model · Backend and frontend code

01 / CAPABILITIES

Templates handle repetition. You build the business.

Controllers, services, DAOs, mappers, lists and forms start from the same business model.

Generate both sides together

Produce backend layers and React / Next.js admin pages from PO classes, reducing repetitive CRUD implementation.

Start with a clear architecture

Organize code by responsibility, package name and module prefix, using dependency inversion and leaving room for business logic.

Configure the interface

Use column_configs to customize visible columns, filters, row menus and status commands for your application.

02 / CLEAN ARCHITECTURE

Clear layers. A complete starting point.

Use sparrow-example for the backend and react-next-admin inside sparrow-js for the frontend. Two independent applications, one business definition.

Backend scaffoldsparrow-example
Frontend scaffoldreact-next-admin
01

Adapter

API entry points & conversion

02

Domain

Domain logic & business rules

03

Infrastructure

Infrastructure & implementations

04

DAO

Persistence interfaces & access

Separate responsibilities through interfaces and dependency inversion, keeping domain logic decoupled from storage implementations.

Spring Boot + React / Next.jsBuild and run independently

03 / WORKFLOW

Define, generate, and make it yours.

Download your project, write the PO classes, generate the code, then continue building in your own application.

  1. 01

    Define a project and download its scaffold

    In Project Configuration, set the project names, business package, frontend project name, module prefix, architecture and scaffold. Configure internationalization and a parent module if needed, then use zip-download to download your backend and frontend business project.

  2. 02

    Build and run your business project

    Run mvn clean package -Dmaven.test.skip=true for the backend, then start the module artifact with java -jar. In the generated frontend directory, run npm install and npm run dev. Build and start the two applications separately.

  3. 03

    Write PO classes in your own package

    In your generated business project, use com.sparrow.coder.po.Department (parent) and com.sparrow.coder.po.UserExample (child) as references. Copy them into your own PO package, such as com.yourcompany.po, and change the package declaration. Describe metadata with @Table and @Column; link the parent table with @ListDatasource(type = ListDatasourceType.TABLE, params = "t_department"). Do not generate business code directly from the official example classes.

  4. 04

    Generate backend and frontend code

    Return to sparrow-coder, select a table and click Generate Code (/coder/generate.json). PO metadata and templates produce the DAO, Domain, Adapter and Infrastructure layers, plus frontend lists and forms. No AI is involved.

  5. 05

    Rebuild and run the generated code

    Return to your business project, rebuild and restart the backend and frontend to activate the generated code. Continue implementing your business logic on top of the generated architecture.

  6. 06

    Customize the interface with column configuration

    Use column_configs in t_table_config to control visible columns, filters, row menus and status commands. Parent-child relationships can automatically produce dropdowns or association controls.

04 / MODEL FIRST

Define fields and relationships in the model.

Use @Table and @Column for table and field metadata, and @ListDatasource for relationships. Templates turn those definitions into code and controls.

From departments to users

Department is the parent table and UserExample is the child. Link departmentId to t_department to generate dropdowns or association controls.

Department1 → NUserExample
UserExample.java · Business PO example (imports omitted)
package com.yourcompany.po;

@Table(name = "t_user_example")
@Data
public class UserExample extends PO {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int COMMENT 'ID'")
    private Long id;

    @Column(name = "user_name", nullable = false,
            columnDefinition = "varchar(32) COMMENT '用户名'")
    private String userName;

    @Column(name = "department_id",
            columnDefinition = "int COMMENT '部门ID'")
    @ListDatasource(type = ListDatasourceType.TABLE,
            params = "t_department")
    private Long departmentId;
}

05 / QUICK START

Set up. Generate your first application.

Install dependencies, configure services and start the generator in order. Expand each step to copy commands and adapt them to your environment.

JDK17+
Maven3.6+
MySQL5.7 / 8.x
Redis5+
Node.js18+

Node.js is only needed for the frontend.

01

Clone the projects and scaffolds

Place dependencies, the frontend workspace and the generator under ~/workspace/sparrow. Place the backend scaffold directly under ~/workspace.

bash
mkdir -p ~/workspace/sparrow
cd ~/workspace/sparrow
git clone https://github.com/sparrowzoo/sparrow-shell.git
git clone https://github.com/sparrowzoo/sparrow-starter.git
git clone https://github.com/sparrowzoo/sparrow-file.git
git clone https://github.com/sparrowzoo/sparrow-passport-ddd.git
git clone https://github.com/sparrowzoo/sparrow-js.git
git clone https://github.com/sparrowzoo/sparrow-coder.git

cd ~/workspace
git clone https://github.com/sparrowzoo/sparrow-example.git

sparrow-example and sparrow are sibling directories. react-next-admin lives inside sparrow-js. Node.js is only required to run the frontend.

02

Install dependencies in order

Install the core framework first, followed by the integration starter, file services and authentication framework. Build sparrow-coder last.

bash
cd ~/workspace/sparrow/sparrow-shell
mvn clean install -Dmaven.test.skip=true
cd ../sparrow-starter
mvn clean install -Dmaven.test.skip=true
cd ../sparrow-file
mvn clean install -Dmaven.test.skip=true
cd ../sparrow-passport-ddd
mvn clean install -Dmaven.test.skip=true
cd ../sparrow-coder
mvn clean install -Dmaven.test.skip=true

sparrow-shell provides infra-bom and sparrow-bom, so it must be installed first.

03

Initialize the database

Start MySQL, create the sparrow database and import the project configuration, table configuration and example table scripts.

bash
cd ~/workspace/sparrow/sparrow-coder
mysql -uroot -p -e "CREATE DATABASE IF NOT EXISTS sparrow;"
mysql -uroot -p sparrow < ddl/t_project_config.sql
mysql -uroot -p sparrow < ddl/t_table_config.sql
mysql -uroot -p sparrow < ddl/t_user_example.sql
04

Configure the workspace and services

Edit coder-main-spring-boot/src/main/resources/application.properties to set your workspace paths, database connection and Redis settings.

properties
workspace=/Users/<your-name>/workspace
project_root=sparrow
frontend_project_root=sparrow/sparrow-js

spring.datasource.druid.url=jdbc:mysql://127.0.0.1/sparrow?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
spring.datasource.druid.username=root
spring.datasource.druid.password=<your-password>

spring.redis.host=127.0.0.1
spring.redis.port=6379

These paths use macOS conventions. Replace the username, database password and service addresses with your local values.

05

Configure frontend static resources

Edit coder-main-spring-boot/src/main/configs/dev.properties so the generator can load its frontend static resources.

properties
physical_resource={your_home_path}/workspace/sparrow/sparrow-js/source

Replace your_home_path with your actual home directory and ensure the path matches the location of sparrow-js.

06

Start the generator

The dev environment uses port 8888 by default. Open the home page and sign in to start configuring projects.

bash
cd ~/workspace/sparrow/sparrow-coder/coder-main-spring-boot
mvn spring-boot:run

Home: http://localhost:8888; API docs: http://localhost:8888/doc.html; Druid monitor: http://localhost:8888/druid (default username and password: druid).

Repositories & scaffolds

sparrow-shell
Core framework, including infra-bom, sparrow-bom and Sparrow modules.
sparrow-starter
Spring Boot integration for the Sparrow framework.
sparrow-file
File services, including file-starter.
sparrow-passport-ddd
Authentication framework, including passport-starter.
sparrow-example
Backend scaffold for generated business projects.
sparrow-js
Frontend workspace containing the react-next-admin scaffold.
sparrow-coder
Project configuration, metadata parsing and template generation.

Generator modules

bom
Dependency versions; coder-bom inherits from infra-bom.
coder-protocol
Protocol layer: Query, Param and enums.
coder-po
Persistent objects and official PO examples.
coder-dao-api
DAO interface definitions.
coder-dao-sparrow
DAO implementation with Sparrow ORM.
coder-dao-mybatis
DAO implementation with MyBatis.
coder-domain
Domain logic and the code generation engine.
coder-infrastructure
Infrastructure layer.
coder-adapter
Adapter layer: Controller and Assemble.
coder-spring-starter
Spring Boot integration starter.
coder-main-spring-boot
Startup module and Application entry point.
ddl
Database schema scripts.

SUPPORT / FAQ

A few things to help you get started.

The build cannot find infra-bom or sparrow-* dependencies?

Confirm that all dependency repositories are cloned, then run mvn clean install in the order shown in the setup guide. Install sparrow-shell first because the other modules depend on its POMs.

The application cannot connect to the database?

Check that MySQL is running, the sparrow database exists, and the connection URL, username and password in application.properties are correct.

Frontend static resources return 404?

Check workspace and frontend_project_root in application.properties, as well as physical_resource in dev.properties. Each path must resolve to the correct local directory.

Can I generate business code directly from the official PO examples?

No. Department and UserExample are references. Copy them into your business project's own PO package and update the package declaration before generation. The generator uses your PO metadata and does not require AI.

BUILD WITH SPARROW

Let your next admin app start with a model.

Define your project and PO classes. Save your time for the logic that makes your business different.