A template plugin for the Portal framework that demonstrates core functionality and best practices.
- Complete REST API with OpenAPI/Swagger documentation
- Frontend single-page application
- Database migrations for MySQL and SQLite
- Email notifications using templates
- File upload handling with progress tracking
- Workflow system integration
- Access control and authentication
- Configuration management
- Build using one of these methods:
a. Using xportal (recommended):
xportal build --with github.com/yourusername/portal-plugin-template@latest
b. Manual build (fallback):
import (
_ "github.com/yourusername/portal-plugin-template" // Import the plugin
)
The plugin will be automatically registered when Portal starts.
The plugin uses the following configuration structure in your Portal config file:
template-plugin:
storage_path: "data/template" # Path to store protocol data
max_items: 1000 # Maximum number of items to store
cache_enabled: true # Whether to enable caching
api:
items_per_page: 10 # Number of items per page in list responses
search_limit: 100 # Maximum number of search results
The plugin provides the following REST API endpoints:
GET /api/items
- List all items (paginated)POST /api/items
- Create a new itemGET /api/items/{id}
- Get a specific itemPUT /api/items/{id}
- Update an itemDELETE /api/items/{id}
- Delete an itemGET /api/items/search
- Search itemsGET /api/items/protected
- List protected items (requires authentication)GET /api/uploads/{id}
- Get upload status
Full API documentation is available at template.{your-portal-domain}/swagger
when the plugin is running, where:
template
is the plugin's hardcoded subdomain{your-portal-domain}
is your Portal instance domain
.
├── build/ # Build information
├── internal/ # Internal package code
│ ├── api/ # REST API implementation
│ ├── config/ # Configuration structures
│ ├── db/ # Database models and migrations
│ ├── protocol/ # Protocol implementation
│ ├── service/ # Service implementations
│ ├── templates/ # Email templates
│ └── webapp/ # Frontend application
└── plugin.go # Plugin entry point
- Define models in
internal/db/models/
- Create migrations in
internal/db/migrations/
- Implement services in
internal/service/
- Add API endpoints in
internal/api/
- Update frontend in
internal/webapp/
Run the test suite:
go test ./...
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
For support, please open an issue in the GitHub repository or contact the maintainers.