Getting started
Structure
The default feature-based project structure
Project Structure
Ply uses a feature-based architecture to keep projects modular and easy to navigate. This is the default structure generated by the CLI.
handler.go
service.go
repository.go
router.go
main.go
.env
README.md
Structure highlights
features/: application features. Each feature is self-contained.features/[feature-name]/handler.go: HTTP handlers.features/[feature-name]/service.go: business logic and domain rules.features/[feature-name]/repository.go: data access for databases, caches and external APIs.features/[feature-name]/router.go: route definitions and feature-level middleware.main.go: application entry point. It initializes the app and registers the feature routers..env: environment variables such asPORT,DB_URLand secret keys.README.md: project documentation.
Why feature-based
- Modular. Each feature is independent and easy to reason about.
- Scalable. New features can be added without touching unrelated code.
- Maintainable. Changes stay within the feature they belong to.
- Testable. Each layer within a feature can be tested on its own.
Generated with the CLI
The structure is created by:
npx create-ply@latest my-app
Ply