{"id":17793366,"url":"https://github.com/sheldenburg/ai-engineer-template","last_synced_at":"2025-03-16T19:30:24.927Z","repository":{"id":257964589,"uuid":"868325184","full_name":"Sheldenburg/ai-engineer-template","owner":"Sheldenburg","description":"Full stack AI engineer serverless template with nextjs and fastapi","archived":false,"fork":false,"pushed_at":"2024-10-26T23:44:38.000Z","size":35868,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-27T00:42:11.598Z","etag":null,"topics":["ai","fastapi","nextjs","openapi","serverless","shadcn-ui","supabase","tailwindcss"],"latest_commit_sha":null,"homepage":"https://ai-engineer-template.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/Sheldenburg.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-06T04:43:16.000Z","updated_at":"2024-10-26T23:44:42.000Z","dependencies_parsed_at":"2024-10-19T15:36:48.209Z","dependency_job_id":null,"html_url":"https://github.com/Sheldenburg/ai-engineer-template","commit_stats":null,"previous_names":["sheldenburg/ai-engineer-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sheldenburg%2Fai-engineer-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sheldenburg%2Fai-engineer-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sheldenburg%2Fai-engineer-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sheldenburg%2Fai-engineer-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sheldenburg","download_url":"https://codeload.github.com/Sheldenburg/ai-engineer-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221667110,"owners_count":16860550,"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","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":["ai","fastapi","nextjs","openapi","serverless","shadcn-ui","supabase","tailwindcss"],"created_at":"2024-10-27T11:08:08.639Z","updated_at":"2024-10-27T11:08:09.451Z","avatar_url":"https://github.com/Sheldenburg.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Engineer Template Nextjs + FastAPI 🚀\n\n![nextjs+fastapi_template](nextjs+fastapi-template.png)\n![nextjs+fastapi_template_dark_mode](nextjs+fastapi-template-dark-mode.png)\n\n### Demo website 🌐\n\nhttps://ai-engineer-template.vercel.app\n\n### Tech stack 🛠️\n\nThe backend code in this repository originated from the [FastAPI full stack template](https://github.com/fastapi/full-stack-fastapi-template) plus additional AI components that make this AI engineer template unique.\n\nTo fast-track MVP building process, which is crucial for most AI products, we have chosen a simple tech stack. This allows people to focus more on iterating through product features rather than on DevOps from the outset.\n\n![architecture](architecture.png)\n\n### How to run in local 🏃‍♂️\n\nRefer to [development](development.md)\n\n### Openapi Fetch\n\n[![Openapi-fetch](https://openapi-ts.pages.dev/assets/openapi-fetch.svg \"Openapi-fetch\")](https://openapi-ts.pages.dev/openapi-fetch/ \"Openapi-fetch\")\n\nSince Nextjs offers caching out-of-box (more caching details refer to [Nextjs caching](http://https://nextjs.org/docs/app/building-your-application/caching \"Nextjs caching\")), we don't have to use React Query, which is an awesome library to manage client side API requests but it has a little bit learning curve for beginners. Rather, the API requests can just be made via fetch (Nextjs added some improvement on the original javascript fetch function). We chose a very light-weight OpenAPI client library just to read the openapi specification file (saved as 'openapi.json') and make sure we have consistent and clearn code.\n\nHere is an example.\nFirst, in '/frontend/lib/api/index.ts' we initiate the API client.\n\n```javascript\nimport createClient from \"openapi-fetch\";\nimport type { paths } from \"./v1\";\nimport { cookies } from \"next/headers\";\n\nconst client =\n  createClient \u003c\n  paths \u003e\n  {\n    baseUrl: process.env.API_BASE_URL,\n    headers: {\n      Authorization: `Bearer ${cookies().get(\"access_token\")?.value}`,\n    },\n  };\nexport default client;\n```\n\nthen, on a server component, we can just do\n\n```javascript\nimport client from \"@/lib/api\";\nasync function getItems() {\n  const { data, error } = await client.GET(\"/api/v1/items/\", {\n    cache: \"no-store\",\n  });\n  if (error) {\n    console.log(error);\n    // any other error handling code\n  }\n  return data;\n}\n```\n\nThis is is a very simple and clean way, in my personal opinion, to handle frontend API requests.\n\n### UI library\n\nWe use [Shadcn](https://ui.shadcn.com/ \"Shadcn\"). It's light-weight, all the UI components are imported as plain javascript code for transparency. So, you can modify to suit your need.\n\n### Deployment\n\nThis is a 100% serverless template! No need to manage a VM or Kubernates yourself. And it will be completely free to start with. Frontend, backend and database code is deployed to three serverless hosting separately with individual scalability.\u003cbr\u003e\nFrontend --\u003e Vercel\u003cbr\u003e\nBackend --\u003e GCP Cloud Run\u003cbr\u003e\nDatabase --\u003e Supabase (Postgres)\u003cbr\u003e\n**You don't need to clickOps the deployment. The whole deployment process is set up via github actions. Whenever there is a merge to the main branch, a CD will be triggered.**\n\nRefer to the guide [here](deployment.md)\n\n### EuclideanAI\n\nWho the hell is EuclideanAI? we are a boutique Data\u0026AI consultancy who provide purpose-built AI, data, machine learning solutions for our clients. [Feel free to reach out!](https://euclideanai.com/contactus/)\n\n### License\n\nThe AI Engineer Template is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheldenburg%2Fai-engineer-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheldenburg%2Fai-engineer-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheldenburg%2Fai-engineer-template/lists"}