{"id":20430724,"url":"https://github.com/jaguar-dart/jaguar","last_synced_at":"2025-10-25T22:07:09.042Z","repository":{"id":41389666,"uuid":"68912891","full_name":"Jaguar-dart/jaguar","owner":"Jaguar-dart","description":"Jaguar, a server framework built for speed, simplicity and extensible. ORM, Session, Authentication \u0026 Authorization, OAuth","archived":false,"fork":false,"pushed_at":"2024-09-08T23:00:41.000Z","size":2921,"stargazers_count":465,"open_issues_count":24,"forks_count":35,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-05-23T19:07:41.981Z","etag":null,"topics":["authentication","authorization","dart","http","jaguar","orm","rest","rest-api","restful","routing","session","web","webserver","websocket"],"latest_commit_sha":null,"homepage":"http://jaguar-dart.github.io","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jaguar-dart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2016-09-22T11:01:50.000Z","updated_at":"2025-03-18T01:50:48.000Z","dependencies_parsed_at":"2024-10-30T01:52:00.919Z","dependency_job_id":null,"html_url":"https://github.com/Jaguar-dart/jaguar","commit_stats":{"total_commits":497,"total_committers":8,"mean_commits":62.125,"dds":0.2756539235412475,"last_synced_commit":"5017911e626fb56ad4a161ee2edc38482bae23cc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Jaguar-dart/jaguar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaguar-dart%2Fjaguar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaguar-dart%2Fjaguar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaguar-dart%2Fjaguar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaguar-dart%2Fjaguar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jaguar-dart","download_url":"https://codeload.github.com/Jaguar-dart/jaguar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaguar-dart%2Fjaguar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281026233,"owners_count":26431755,"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-10-25T02:00:06.499Z","response_time":81,"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":["authentication","authorization","dart","http","jaguar","orm","rest","rest-api","restful","routing","session","web","webserver","websocket"],"created_at":"2024-11-15T08:08:49.116Z","updated_at":"2025-10-25T22:07:09.028Z","avatar_url":"https://github.com/Jaguar-dart.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Pub](https://img.shields.io/pub/v/jaguar.svg)](https://pub.dartlang.org/packages/jaguar)\n[![Build Status](https://travis-ci.org/Jaguar-dart/jaguar.svg?branch=master)](https://travis-ci.org/Jaguar-dart/jaguar)\n[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/jaguar_dart/jaguar)\n\n# Jaguar\n\nJaguar is a full-stack production ready HTTP server framework built to be fast, simple and intuitive.\n\n# Getting started\n\n## Familiar way to write routes\n\n[`Jaguar`][Doc::Jaguar] class provides methods [`get`][Doc::Jaguar::get], [`put`][Doc::Jaguar::put], [`post`][Doc::Jaguar::post], \n[`delete`][Doc::Jaguar::delete] and [`options`][Doc::Jaguar::options] to quickly add route handlers for specific HTTP methods.\n\n```dart\nmain() async {\n  final server = Jaguar();  // Serves the API at localhost:8080 by default\n  // Add a route handler for 'GET' method at path '/hello'\n  server.get('/hello', (Context ctx) =\u003e 'Hello world!');\n  await server.serve();\n}\n```\n\n## Powerful route matching\n\n### Easily define and access Path parameters\n\nPath segments prefixed with `:` can match any value and are also captured as path variables. Path variables can be accessed\nusing `pathParams` member of `Context` object.\n\n```dart\nmain(List\u003cString\u003e args) async {\n  final quotes = \u003cString\u003e[\n    'But man is not made for defeat. A man can be destroyed but not defeated.',\n    'When you reach the end of your rope, tie a knot in it and hang on.',\n    'Learning never exhausts the mind.',\n  ];\n\n  final server = Jaguar();\n  server.get('/api/quote/:index', (ctx) { // The magic!\n    final int index = ctx.pathParams.getInt('index', 1);  // The magic!\n    return quotes[index + 1];\n  });\n  await server.serve();\n}\n```\n\n+ A path can have multiple path variables.\n+ A path variable can appear at any position in the path.\n+ A path variable can be matched against a Regular expression.\n+ `getInt`, `getDouble`, `getNum` and `getBool` methods can be used to easily typecast path variables.\n+ Using * as the final path segment captures/matches all following segments.\n\n## Easily access Query parameters\n\nQuery parameters can be accessed using `queryParams` member of `Context` object.\n\n```dart\nmain(List\u003cString\u003e args) async {\n  final quotes = \u003cString\u003e[\n    'But man is not made for defeat. A man can be destroyed but not defeated.',\n    'When you reach the end of your rope, tie a knot in it and hang on.',\n    'Learning never exhausts the mind.',\n  ];\n\n  final server = Jaguar();\n  server.get('/api/quote', (ctx) {\n    final int index = ctx.queryParams.getInt('index', 1); // The magic!\n    return quotes[index + 1];\n  });\n  await server.serve();\n}\n```\n\n`getInt`, `getDouble`, `getNum` and `getBool` methods can be used to easily typecast query parameters into desired type.\n\n## One liner to access Forms\n\nA single line is all it takes to obtain a form as a `Map\u003cString, String\u003e` using method [`bodyAsUrlEncodedForm`][Doc::Request::bodyAsUrlEncodedForm] \non [`Request`][Doc::Request] object.\n\n```dart\nmain(List\u003cString\u003e arguments) async {\n  final server = Jaguar(port: 8005);\n\n  server.postJson('/api/add', (ctx) async {\n      final Map\u003cString, String\u003e map = await ctx.req.bodyAsUrlEncodedForm(); // The magic!\n      contacts.add(Contact.create(map));\n      return contacts.map((ct) =\u003e ct.toMap).toList();\n    });\n\n\n  await server.serve();\n}\n```\n\n## One liner to serve static files\n\nThe method [`staticFiles`][Doc::Jaguar::staticFiles] adds static files to `Jaguar` server. The first argument determines\nthe request Uri that much be matched and the second argument determines the directory from which the target files are fetched.\n\n```dart\nmain() async {\n  final server = Jaguar();\n  server.staticFiles('/static/*', 'static'); // The magic!\n  await server.serve();\n}\n```\n\n## JSON serialization with little effort\n\nDecoding JSON requests can't be simpler than using one of the built-in [`bodyAsJson`][Doc::Request::bodyAsJson], \n[`bodyAsJsonMap`][Doc::Request::bodyAsJsonMap] or [`bodyAsJsonList`][Doc::Request::bodyAsJsonList] methods on \n[`Request`][Doc::Request] object.\n\n```dart\nFuture\u003cvoid\u003e main(List\u003cString\u003e args) async {\n  final server = Jaguar();\n  server.postJson('/api/book', (Context ctx) async {\n    // Decode request body as JSON Map\n    final Map\u003cString, dynamic\u003e json = await ctx.req.bodyAsJsonMap();\n    Book book = Book.fromMap(json);\n    return book; // Automatically encodes Book to JSON\n  });\n\n  await server.serve();\n}\n```\n\n## Out-of-the-box Sessions support\n\n```dart\nmain() async {\n  final server = Jaguar();\n  server.get('/api/add/:item', (ctx) async {\n    final Session session = await ctx.req.session;\n    final String newItem = ctx.pathParams.item;\n\n    final List\u003cString\u003e items = (session['items'] ?? '').split(',');\n\n    // Add item to shopping cart stored on session\n    if (!items.contains(newItem)) {\n      items.add(newItem);\n      session['items'] = items.join(',');\n    }\n\n    return Response.redirect('/');\n  });\n  server.get('/api/remove/:item', (ctx) async {\n    final Session session = await ctx.req.session;\n    final String newItem = ctx.pathParams.item;\n\n    final List\u003cString\u003e items = (session['items'] ?? '').split(',');\n\n    // Remove item from shopping cart stored on session\n    if (items.contains(newItem)) {\n      items.remove(newItem);\n      session['items'] = items.join(',');\n    }\n\n    return Response.redirect('/');\n  });\n  await server.serve();\n}\n```\n\n[Doc::Jaguar]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Jaguar-class.html\n[Doc::Jaguar::get]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Muxable/get.html\n[Doc::Jaguar::delete]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Muxable/delete.html\n[Doc::Jaguar::post]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Muxable/post.html\n[Doc::Jaguar::put]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Muxable/put.html\n[Doc::Jaguar::options]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Muxable/options.html\n[Doc::Jaguar::staticFiles]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Muxable/staticFiles.html\n[Doc::Request]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Request-class.html\n[Doc::Request::bodyAsJson]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Request/bodyAsJson.html\n[Doc::Request::bodyAsJsonMap]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Request/bodyAsJsonMap.html\n[Doc::Request::bodyAsJsonList]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Request/bodyAsJsonList.html\n[Doc::Request::bodyAsUrlEncodedForm]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Request/bodyAsUrlEncodedForm.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaguar-dart%2Fjaguar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaguar-dart%2Fjaguar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaguar-dart%2Fjaguar/lists"}