{"id":30328491,"url":"https://github.com/xirelta/xirelta","last_synced_at":"2025-08-18T01:05:06.357Z","repository":{"id":195171255,"uuid":"692395255","full_name":"xirelta/xirelta","owner":"xirelta","description":"A lightweight web framework for building web applications in TypeScript with Bun. It is designed to be flexible and easy to use, allowing you to create web services and applications with minimal effort.","archived":false,"fork":false,"pushed_at":"2023-10-23T14:04:32.000Z","size":499,"stargazers_count":15,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-13T23:43:52.692Z","etag":null,"topics":["bun","server","web"],"latest_commit_sha":null,"homepage":"https://xirelta.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xirelta.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-16T10:53:30.000Z","updated_at":"2025-05-14T03:31:54.000Z","dependencies_parsed_at":"2023-09-22T12:41:18.178Z","dependency_job_id":"cbee097c-6119-457f-8c44-fc8f29d7be53","html_url":"https://github.com/xirelta/xirelta","commit_stats":null,"previous_names":["imlunahey/xirelta","xirelta/xirelta"],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/xirelta/xirelta","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xirelta%2Fxirelta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xirelta%2Fxirelta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xirelta%2Fxirelta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xirelta%2Fxirelta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xirelta","download_url":"https://codeload.github.com/xirelta/xirelta/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xirelta%2Fxirelta/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270928334,"owners_count":24669487,"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-08-17T02:00:09.016Z","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":["bun","server","web"],"created_at":"2025-08-18T01:02:39.404Z","updated_at":"2025-08-18T01:05:06.342Z","avatar_url":"https://github.com/xirelta.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Xirelta Web Framework\n\n\u003cp align=\"left\"\u003e\n  \u003cimg src=\"./.github/assets/logo.png\" alt=\"Xirelta Logo\" width=\"100\" height=\"100\"/\u003e\n\u003c/p\u003e\n\nXirelta is a lightweight web framework for building web applications in TypeScript with Bun. It is designed to be flexible and easy to use, allowing you to create web services and applications with minimal effort.\n\n## Installation\n\nYou can install Xirelta using Bun:\n\n```bash\nbun add xirelta\n```\n\n## Getting Started\n\nTo get started with Xirelta, you need to create an instance of the `Application` class and define your routes and handlers. Here's a basic example:\n\n```typescript\nimport { Application } from 'xirelta';\n\nconst app = new Application();\n\napp.get('/', (request) =\u003e {\n  return 'Hello, Xirelta!';\n});\n\napp.start().then((serverInfo) =\u003e {\n  console.log(`Server is running on port ${serverInfo.port}`);\n});\n```\n\nIn this example, we create a simple web server that listens on the root path and responds with \"Hello, Xirelta!\" when accessed.\n\n## Defining Routes\n\nYou can define routes for various HTTP methods using the following methods:\n\n- `app.all(path, handler)`: Matches all HTTP methods.\n- `app.get(path, handler)`: Matches GET requests.\n- `app.post(path, handler)`: Matches POST requests.\n- `app.put(path, handler)`: Matches PUT requests.\n- `app.delete(path, handler)`: Matches DELETE requests.\n\nThe `path` parameter is a string that defines the URL pattern for the route, and the `handler` parameter is a function that handles the incoming requests and returns a response.\n\n## Handling Requests\n\nThe `handler` function takes a request object as its parameter, which contains information about the incoming request. You can access parameters, query strings, request bodies, and more from this object.\n\nHere's an example of handling a GET request with a parameter:\n\n```typescript\napp.get('/user/:id', (request) =\u003e {\n  const userId = request.params.id;\n  // Retrieve user data based on the userId\n  const user = getUserById(userId);\n  if (!user) {\n    return new Response('User not found', { status: 404 });\n  }\n  return user;\n});\n```\n\nIn this example, we define a route with a parameter `:id` in the URL pattern. We then access this parameter using `request.params.id` and use it to retrieve user data.\n\n## Custom Responses\n\nYou can return custom responses using the `Response` class or plain JSON objects. Xirelta will handle serializing these responses appropriately.\n\n```typescript\napp.get('/json', (request) =\u003e {\n  return {\n    message: 'This is a JSON response',\n  };\n});\n\napp.get('/custom-response', (request) =\u003e {\n  return new Response('Custom Response', { status: 200, headers: { 'Content-Type': 'text/plain' } });\n});\n```\n\n## Starting and Stopping the Server\n\nTo start the Xirelta web server, call the `start` method on your `Application` instance. It returns a promise that resolves with information about the server, including the port it's listening on.\n\n```typescript\napp.start().then((serverInfo) =\u003e {\n  console.log(`Server is running on port ${serverInfo.port}`);\n});\n```\n\nTo stop the server, use the `stop` method:\n\n```typescript\napp.stop().then(() =\u003e {\n  console.log('Server has stopped');\n});\n```\n\n## Configuration\n\nXirelta allows you to configure various options for your application, including the web server's port and logging. You can pass a configuration object when creating an `Application` instance:\n\n```typescript\nconst config = {\n  web: {\n    port: 8080, // Set the port to 8080\n  },\n  logger: {\n    debug(message, options) {\n      console.debug(message, options);\n    },\n    info(message, options) {\n      console.info(message, options);\n    },\n  },\n};\n\nconst app = new Application(config);\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxirelta%2Fxirelta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxirelta%2Fxirelta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxirelta%2Fxirelta/lists"}