{"id":33907341,"url":"https://github.com/tricksterperl/trickster","last_synced_at":"2025-12-12T02:43:16.312Z","repository":{"id":326351255,"uuid":"1105254507","full_name":"tricksterperl/trickster","owner":"tricksterperl","description":"Fast, minimal, zero-dependency PSGI micro-framework with stateless signed-cookie sessions, modern middleware, and a joyful developer experience. Built for 2025 and beyond.","archived":false,"fork":false,"pushed_at":"2025-11-27T11:00:46.000Z","size":709,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-30T02:21:00.849Z","etag":null,"topics":["framework","perl","web"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tricksterperl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-27T10:52:49.000Z","updated_at":"2025-11-27T11:00:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tricksterperl/trickster","commit_stats":null,"previous_names":["tricksterperl/trickster"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/tricksterperl/trickster","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tricksterperl%2Ftrickster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tricksterperl%2Ftrickster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tricksterperl%2Ftrickster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tricksterperl%2Ftrickster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tricksterperl","download_url":"https://codeload.github.com/tricksterperl/trickster/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tricksterperl%2Ftrickster/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27675132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework","perl","web"],"created_at":"2025-12-12T02:43:15.796Z","updated_at":"2025-12-12T02:43:16.296Z","avatar_url":"https://github.com/tricksterperl.png","language":"Perl","readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"assets/trickster.png\" width=\"200\"\u003e\n\n\n# 🎭 Trickster\n\nA modern, battle-tested micro-framework for building web applications in Perl.\n\n[![CPAN Version](https://img.shields.io/cpan/v/Trickster.svg?style=flat-square)](https://metacpan.org/pod/Trickster)\n[![Perl Version](https://img.shields.io/badge/perl-5.14%2B-blue.svg?style=flat-square)](https://www.perl.org/)\n[![License](https://img.shields.io/badge/license-Artistic%202.0%20%7C%20GPL-blue.svg?style=flat-square)](LICENSE)\n[![Coverage](https://img.shields.io/codecov/c/github/tricksterperl/trickster?style=flat-square)](https://codecov.io/gh/trickster-perl/trickster)\n\n[Documentation](https://tricksterperl.github.io) • [Quick Start](#quick-start) • [Examples](examples/) • [Contributing](CONTRIBUTING.md)\n\n\u003c/div\u003e\n\n---\n\n## Philosophy\n\nTrickster brings contemporary web framework design to Perl while respecting CPAN traditions.\n\n- **Minimal Core** – Light dependencies, focused on essentials\n- **PSGI Native** – Built on PSGI/Plack for maximum compatibility\n- **Modern Perl** – Uses Perl 5.14+ features while remaining accessible\n- **CPAN Friendly** – Integrates seamlessly with existing CPAN modules\n- **Battle-Tested** – Production-grade error handling and performance\n- **No Magic** – Explicit is better than implicit\n\n## Installation\n\n### Via CPAN (Recommended)\n\n```bash\ncpanm Trickster\n```\n\n### Via cpanfile\n\n```bash\ncpanm --installdeps .\n```\n\n### Traditional CPAN\n\n```bash\nperl Makefile.PL\nmake\nmake test\nmake install\n```\n\nThis will also install the `trickster` command-line tool.\n\n---\n\n## Quick Start\n\n### Using the CLI (Recommended)\n\n```bash\n# Create a new application\ntrickster new myapp\n\n# Navigate and install dependencies\ncd myapp \u0026\u0026 cpanm --installdeps .\n\n# Start the development server\ntrickster server\n```\n\nVisit **http://localhost:5678**\n\n### Hello World (Manual)\n\n```perl\nuse Trickster;\n\nmy $app = Trickster-\u003enew;\n\n$app-\u003eget('/', sub {\n    my ($req, $res) = @_;\n    return \"Welcome to Trickster\";\n});\n\n$app-\u003eget('/hello/:name', sub {\n    my ($req, $res) = @_;\n    my $name = $req-\u003eparam('name');\n    return \"Hello, $name\";\n});\n\n$app-\u003eto_app;\n```\n\nRun with any PSGI server:\n\n```bash\nplackup app.psgi\n```\n\n---\n\n## Features\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"50%\" valign=\"top\"\u003e\n\n**Routing**\n- Path parameters: `/user/:id`\n- Constraints: `qr/^\\d+$/`\n- Named routes for URL generation\n- Multiple HTTP methods\n- Wildcard routes\n\n**Request/Response**\n- JSON parsing \u0026 serialization\n- Cookie handling (secure \u0026 signed)\n- File uploads\n- Response helpers (JSON, HTML, redirects)\n- Custom headers \u0026 status codes\n\n**Templates**\n- Powered by Text::Xslate\n- TTerse syntax (Template Toolkit-like)\n- Layout support\n- Template caching\n- Custom functions\n\n\u003c/td\u003e\n\u003ctd width=\"50%\" valign=\"top\"\u003e\n\n**Security \u0026 Validation**\n- Built-in data validation\n- Exception handling (typed errors)\n- Secure cookie encryption\n- CSRF protection ready\n- XSS prevention helpers\n\n**Developer Experience**\n- CLI for scaffolding \u0026 generators\n- Hot-reload development server\n- Comprehensive logging\n- PSGI/Plack middleware compatible\n- Extensive test utilities\n\n**Performance**\n- Minimal overhead\n- Template caching\n- Efficient routing engine\n- Production-ready out of the box\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n---\n\n## Code Examples\n\n### REST API with JSON\n\n```perl\nuse Trickster;\nuse Trickster::Request;\nuse Trickster::Response;\n\nmy $app = Trickster-\u003enew;\n\n$app-\u003eget('/api/users/:id', sub {\n    my ($req, $res) = @_;\n    $req = Trickster::Request-\u003enew($req-\u003eenv);\n    $res = Trickster::Response-\u003enew;\n    \n    my $id = $req-\u003eparam('id');\n    my $user = get_user($id);\n    \n    return $res-\u003ejson($user);\n});\n\n$app-\u003epost('/api/users', sub {\n    my ($req, $res) = @_;\n    $req = Trickster::Request-\u003enew($req-\u003eenv);\n    $res = Trickster::Response-\u003enew;\n    \n    my $data = $req-\u003ejson;\n    my $user = create_user($data);\n    \n    return $res-\u003ejson($user, 201);\n});\n```\n\n### Data Validation\n\n```perl\nuse Trickster::Validator;\n\n$app-\u003epost('/register', sub {\n    my ($req, $res) = @_;\n    my $data = $req-\u003ejson;\n    \n    my $validator = Trickster::Validator-\u003enew({\n        name  =\u003e ['required', ['min', 3], ['max', 50]],\n        email =\u003e ['required', 'email'],\n        age   =\u003e ['numeric', ['min', 18]],\n    });\n    \n    unless ($validator-\u003evalidate($data)) {\n        return $res-\u003ejson({ errors =\u003e $validator-\u003eerrors }, 400);\n    }\n    \n    # Process valid data...\n    return $res-\u003ejson({ success =\u003e 1 }, 201);\n});\n```\n\n### Template Rendering\n\n```perl\nuse Trickster::Template;\n\nmy $template = Trickster::Template-\u003enew(\n    path =\u003e ['templates'],\n    cache =\u003e 1,\n    layout =\u003e 'layouts/main.tx',\n);\n\n$app-\u003eget('/profile/:username', sub {\n    my ($req, $res) = @_;\n    my $username = $req-\u003eparam('username');\n    \n    my $html = $template-\u003erender('profile.tx', {\n        title =\u003e 'User Profile',\n        user  =\u003e get_user($username),\n    });\n    \n    return $res-\u003ehtml($html);\n});\n```\n\n### Exception Handling\n\n```perl\nuse Trickster::Exception;\n\n$app-\u003eget('/user/:id', sub {\n    my ($req, $res) = @_;\n    my $id = $req-\u003eparam('id');\n    \n    my $user = find_user($id);\n    \n    unless ($user) {\n        Trickster::Exception::NotFound-\u003ethrow(\n            message =\u003e \"User not found\"\n        );\n    }\n    \n    return $res-\u003ejson($user);\n});\n\n# Custom error handler\n$app-\u003eerror_handler(sub {\n    my ($error, $req, $res) = @_;\n    \n    if (ref($error) \u0026\u0026 $error-\u003eisa('Trickster::Exception')) {\n        return $res-\u003ejson($error-\u003eas_hash, $error-\u003estatus)-\u003efinalize;\n    }\n    \n    return $res-\u003ejson({ error =\u003e 'Server Error' }, 500)-\u003efinalize;\n});\n```\n\n---\n\n## CLI Commands\n\nTrickster includes a powerful command-line interface:\n\n```bash\n# Scaffold new application\ntrickster new myapp\n\n# Generate components\ntrickster generate controller User\ntrickster generate model Post\ntrickster generate template about\n\n# Development server with hot-reload\ntrickster server --reload --port 3000\n\n# Show version\ntrickster version\n```\n\n---\n\n## Testing\n\nComprehensive test suite included:\n\n```bash\n# Run all tests\nprove -l t/\n\n# With verbose output\nprove -lv t/\n\n# Single test file\nprove -lv t/01-routing.t\n```\n\nTest coverage: **85%+**\n\n---\n\n## Examples\n\nCheck out the `examples/` directory for complete working applications:\n\n| Example | Description | Run Command |\n|---------|-------------|-------------|\n| `hello.psgi` | Basic routing \u0026 parameters | `plackup examples/hello.psgi` |\n| `api.psgi` | Full REST API with CRUD | `plackup examples/api.psgi` |\n| `template.psgi` | Template engine demo | `plackup examples/template.psgi` |\n| `advanced.psgi` | All features showcase | `plackup examples/advanced.psgi` |\n| `middleware.psgi` | Middleware integration | `plackup examples/middleware.psgi` |\n\n---\n\n## Requirements\n\n### Core Dependencies\n\n- **Perl 5.14+** \n- Plack 1.0047+\n- JSON::PP (core)\n- URI::Escape (core)\n- Digest::SHA (core)\n- Time::Piece (core)\n\n### Optional\n\n- **Text::Xslate 3.0+** – For template engine support\n\n```bash\ncpanm Text::Xslate\n# or\ncpanm --installdeps . --with-feature=templates\n```\n\n---\n\n## Contributing\n\nContributions are welcome. Please ensure:\n\n- Code follows Perl best practices\n- Tests are included for new features\n- Documentation is updated\n- Changes maintain backward compatibility\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for details.\n\n## License\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, under the terms of either:\n\n- The **Artistic License 2.0**\n- The **GNU General Public License** as published by the Free Software Foundation; either version 1, or (at your option) any later version\n\nSee [LICENSE](LICENSE) for more details.\n\n## Author\n\nTrickster Contributors\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftricksterperl%2Ftrickster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftricksterperl%2Ftrickster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftricksterperl%2Ftrickster/lists"}