{"id":24790325,"url":"https://github.com/lifespikes/apext","last_synced_at":"2025-10-12T14:30:56.472Z","repository":{"id":50650863,"uuid":"519716685","full_name":"lifespikes/apext","owner":"lifespikes","description":"🗺 A simple CLI tool to manage and organize Next.js API routes.","archived":false,"fork":false,"pushed_at":"2023-04-07T20:44:11.000Z","size":803,"stargazers_count":12,"open_issues_count":5,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-29T04:49:11.900Z","etag":null,"topics":["cli","nextjs","nodejs","typescript"],"latest_commit_sha":null,"homepage":"http://apext.vercel.app","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/lifespikes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-31T08:14:01.000Z","updated_at":"2023-08-09T22:23:42.000Z","dependencies_parsed_at":"2023-02-08T08:31:34.303Z","dependency_job_id":null,"html_url":"https://github.com/lifespikes/apext","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/lifespikes/apext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifespikes%2Fapext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifespikes%2Fapext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifespikes%2Fapext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifespikes%2Fapext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lifespikes","download_url":"https://codeload.github.com/lifespikes/apext/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifespikes%2Fapext/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011599,"owners_count":26084964,"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-12T02:00:06.719Z","response_time":53,"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":["cli","nextjs","nodejs","typescript"],"created_at":"2025-01-29T18:15:38.866Z","updated_at":"2025-10-12T14:30:56.021Z","avatar_url":"https://github.com/lifespikes.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![apextgithub](https://user-images.githubusercontent.com/71573508/182018691-edc8aa18-04a4-4976-bdae-890ada85cc1f.png)\n\n\n![output](https://user-images.githubusercontent.com/71573508/185773820-7dcdbdb7-535d-4315-bb5c-71f1045f3b88.gif)\n\n\n# APEXT\n\n\u003csup\u003epronounced */eɪpekst/*\u003csup\u003e\n\nA simple CLI tool to manage and organize Next.js API routes.\n\n\u003csup\u003eInspired by the [Laravel Artisan `route:list` Command](https://stillat.com/blog/2016/12/07/laravel-artisan-route-command-the-routelist-command)\u003csup\u003e\n\n# Install\n\n#### On Mac via homebrew\n\n```bash\nbrew install lifespikes/apext/apext\n```\n\n#### Via NPM\n\n```bash\nnpm i -g apext\n```\n\n# API (Commands)\n\n### 1. 🎯 `list`\n\n**Place yourself on your Next.js root directory and run `apext list`**\n\n#### Flags:\n\n`--path` - **optional** (will output a specific path routes, `/api` is default)\n\n\n#### Example:\n\n```bash\napext list --path auth\n```\n\n#### Extra:\n\nDisplay your route accepted http methods by adding the `// @methods` comment. Check the `🎯 create` command below.\n\n```js\n// my-route.ts\n\n// @methods [GET, POST, PUT, DELETE]\n\n// ...rest of the file\n```\n\n\n### 2. 🎯 `create`\n\nWill create an API endpoint following a REST structure.\n\n#### Argument:\n\n`\u003cname\u003e` - **required** (the name of your API endpoint)\n\n#### Flags:\n\n`--path` - **optional** (`/api` folder is default)\n\n`--ts` - **optional** (`.js` file is generated by default)\n\n\n#### Example:\n\n```bash\napext create login --path auth --ts\n```\n\n#### Notes:\n\n1. When stating a `--path` you can create nested directories like `path/nested-path`.\n2. If a folder does not exists, APEXT will create the folder for you.\n\n#### Output file example (Typescript):\n\n```ts\nimport type { NextApiRequest, NextApiResponse } from 'next'\n\n// APEXT methods comment 👇\n// @methods [GET, POST, PUT, DELETE]\n\nexport default async function name(\n  req: NextApiRequest,\n  res: NextApiResponse\n) {\n  switch (req.method) {\n    case 'GET':\n    case 'POST':\n    case 'PUT':    \n    case 'DELETE':\n    default:\n      res.setHeader('Allow', [\n        'GET',\n        'POST',\n        'PUT',\n        'DELETE',\n    ])\n      return res.status(405).end(`Method ${req.method} Not Allowed`)\n  }\n}\n```\n\n# Config File\n\nYou can add an `apext.config.js` to your Next.js project root directory.\n\n### Options:\n  \n| option     | type     | description                                                                                                                                                                                          |\n|------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| tsContent  | function | A function `(name: string) =\u003e string`. Takes one argument `name` and returns a string. It allows you to set up the content of the API route when just being created with the `create` command.       |\n| jsContent  | function | A function  `(name: string) =\u003e string` . Takes one argument  `name`  and returns a string. It allows you to set up the content of the API route when just being created with the  `create`  command. |\n| typescript | boolean  | If you are programming in Typescript you can set up this option and all API routes will be Typescript files without specifying the `--ts` flag.                                                      |                                                   |   |   |                                                   |   |   |\n  \n### Example of tsContent/jsContent\n  \n```js\n  module.exports = {\n    jsContent: (name) =\u003e `\n      export default async function ${name} (req, res) {\n        return res.status(200).json('Hello from Apext Config')\n      }\n    `\n  }\n  \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifespikes%2Fapext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flifespikes%2Fapext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifespikes%2Fapext/lists"}