├── .eslintignore ├── .eslintrc.cjs ├── .gitignore ├── .npmrc ├── .prettierignore ├── .prettierrc ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── bun.lockb ├── package.json ├── postcss.config.cjs ├── src ├── app.d.ts ├── app.html ├── app.postcss ├── lib │ ├── index.ts │ └── interfaces │ │ ├── api.ts │ │ └── generate.ts └── routes │ ├── +layout.svelte │ ├── +layout.ts │ ├── +page.css │ ├── +page.svelte │ └── api │ └── generate │ └── +server.ts ├── static └── favicon.png ├── svelte.config.js ├── tailwind.config.ts ├── tsconfig.json └── vite.config.ts /.eslintignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | 10 | # Ignore files for PNPM, NPM and YARN 11 | pnpm-lock.yaml 12 | package-lock.json 13 | yarn.lock 14 | -------------------------------------------------------------------------------- /.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | /** @type { import("eslint").Linter.Config } */ 2 | module.exports = { 3 | root: true, 4 | extends: [ 5 | 'eslint:recommended', 6 | 'plugin:@typescript-eslint/recommended', 7 | 'plugin:svelte/recommended', 8 | 'prettier' 9 | ], 10 | parser: '@typescript-eslint/parser', 11 | plugins: ['@typescript-eslint'], 12 | parserOptions: { 13 | sourceType: 'module', 14 | ecmaVersion: 2020, 15 | extraFileExtensions: ['.svelte'] 16 | }, 17 | env: { 18 | browser: true, 19 | es2017: true, 20 | node: true 21 | }, 22 | overrides: [ 23 | { 24 | files: ['*.svelte'], 25 | parser: 'svelte-eslint-parser', 26 | parserOptions: { 27 | parser: '@typescript-eslint/parser' 28 | } 29 | } 30 | ] 31 | }; 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | vite.config.js.timestamp-* 10 | vite.config.ts.timestamp-* 11 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Ignore files for PNPM, NPM and YARN 2 | pnpm-lock.yaml 3 | package-lock.json 4 | yarn.lock 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": true, 3 | "singleQuote": true, 4 | "trailingComma": "none", 5 | "printWidth": 100, 6 | "plugins": ["prettier-plugin-svelte"], 7 | "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "prettier.documentSelectors": [ 3 | "**/*.svelte" 4 | ], 5 | "tailwindCSS.classAttributes": [ 6 | "class", 7 | "accent", 8 | "active", 9 | "animIndeterminate", 10 | "aspectRatio", 11 | "background", 12 | "badge", 13 | "bgBackdrop", 14 | "bgDark", 15 | "bgDrawer", 16 | "bgLight", 17 | "blur", 18 | "border", 19 | "button", 20 | "buttonAction", 21 | "buttonBack", 22 | "buttonClasses", 23 | "buttonComplete", 24 | "buttonDismiss", 25 | "buttonNeutral", 26 | "buttonNext", 27 | "buttonPositive", 28 | "buttonTextCancel", 29 | "buttonTextConfirm", 30 | "buttonTextFirst", 31 | "buttonTextLast", 32 | "buttonTextNext", 33 | "buttonTextPrevious", 34 | "buttonTextSubmit", 35 | "caretClosed", 36 | "caretOpen", 37 | "chips", 38 | "color", 39 | "controlSeparator", 40 | "controlVariant", 41 | "cursor", 42 | "display", 43 | "element", 44 | "fill", 45 | "fillDark", 46 | "fillLight", 47 | "flex", 48 | "flexDirection", 49 | "gap", 50 | "gridColumns", 51 | "height", 52 | "hover", 53 | "inactive", 54 | "indent", 55 | "justify", 56 | "meter", 57 | "padding", 58 | "position", 59 | "regionAnchor", 60 | "regionBackdrop", 61 | "regionBody", 62 | "regionCaption", 63 | "regionCaret", 64 | "regionCell", 65 | "regionChildren", 66 | "regionChipList", 67 | "regionChipWrapper", 68 | "regionCone", 69 | "regionContent", 70 | "regionControl", 71 | "regionDefault", 72 | "regionDrawer", 73 | "regionFoot", 74 | "regionFootCell", 75 | "regionFooter", 76 | "regionHead", 77 | "regionHeadCell", 78 | "regionHeader", 79 | "regionIcon", 80 | "regionInput", 81 | "regionInterface", 82 | "regionInterfaceText", 83 | "regionLabel", 84 | "regionLead", 85 | "regionLegend", 86 | "regionList", 87 | "regionListItem", 88 | "regionNavigation", 89 | "regionPage", 90 | "regionPanel", 91 | "regionRowHeadline", 92 | "regionRowMain", 93 | "regionSummary", 94 | "regionSymbol", 95 | "regionTab", 96 | "regionTrail", 97 | "ring", 98 | "rounded", 99 | "select", 100 | "shadow", 101 | "slotDefault", 102 | "slotFooter", 103 | "slotHeader", 104 | "slotLead", 105 | "slotMessage", 106 | "slotMeta", 107 | "slotPageContent", 108 | "slotPageFooter", 109 | "slotPageHeader", 110 | "slotSidebarLeft", 111 | "slotSidebarRight", 112 | "slotTrail", 113 | "spacing", 114 | "text", 115 | "track", 116 | "transition", 117 | "width", 118 | "zIndex" 119 | ] 120 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Cloudmate Co., Ltd. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Backend Generator AI 2 | 3 | ## Description 4 | 5 | This is a prototype of backend code generator using LLM. 6 | Use Ollama to run LLM locally. 7 | And provides a web interface for easy use. 8 | 9 | ## Caution 10 | 11 | - This is a prototype. 12 | - Generated code is may not work very nice. 13 | 14 | ## Prepare 15 | 16 | - Install [Ollama](https://ollama.ai/download) 17 | - `ollama pull codellama` 18 | 19 | ## Start server 20 | 21 | ```bash 22 | git clone https://github.com/cloudmatelabs/backend-generator-ai.git 23 | cd backend-generator-ai 24 | bun install 25 | bun run dev 26 | ``` 27 | 28 | and open http://localhost:5173 29 | 30 | If you not want to use bun, you can use `npm` or `yarn` or `pnpm`. 31 | 32 | ## Usage 33 | 34 | 1. Fill in the form and click "Generate" button. 35 | 2. Wait for a while and you will see the generated code. 36 | 37 | ## License 38 | 39 | [MIT](LICENSE) 40 | -------------------------------------------------------------------------------- /bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnlabcloudmatelabs/backend-generator-ai/2976f1a951bcd9be6ed1077da3305d04a6c59036/bun.lockb -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "backend-generator-ai", 3 | "version": "0.0.1-alpha", 4 | "private": true, 5 | "scripts": { 6 | "dev": "vite dev", 7 | "build": "vite build", 8 | "preview": "vite preview", 9 | "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", 10 | "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", 11 | "lint": "prettier --check . && eslint .", 12 | "format": "prettier --write ." 13 | }, 14 | "devDependencies": { 15 | "@skeletonlabs/skeleton": "2.7.0", 16 | "@skeletonlabs/tw-plugin": "0.3.1", 17 | "@sveltejs/adapter-auto": "^3.1.0", 18 | "@sveltejs/kit": "^2.0.0", 19 | "@sveltejs/vite-plugin-svelte": "^3.0.0", 20 | "@tailwindcss/forms": "0.5.7", 21 | "@tailwindcss/typography": "0.5.10", 22 | "@types/eslint": "8.56.0", 23 | "@types/marked": "^6.0.0", 24 | "@types/node": "20.10.6", 25 | "@typescript-eslint/eslint-plugin": "^6.0.0", 26 | "@typescript-eslint/parser": "^6.0.0", 27 | "autoprefixer": "10.4.16", 28 | "eslint": "^8.56.0", 29 | "eslint-config-prettier": "^9.1.0", 30 | "eslint-plugin-svelte": "^2.35.1", 31 | "postcss": "8.4.33", 32 | "prettier": "^3.1.1", 33 | "prettier-plugin-svelte": "^3.1.2", 34 | "svelte": "^4.2.7", 35 | "svelte-check": "^3.6.0", 36 | "tailwindcss": "3.4.0", 37 | "tslib": "^2.4.1", 38 | "typescript": "^5.0.0", 39 | "vite": "^5.0.3", 40 | "vite-plugin-tailwind-purgecss": "0.2.0" 41 | }, 42 | "type": "module", 43 | "dependencies": { 44 | "@floating-ui/dom": "1.5.3", 45 | "@langchain/community": "^0.0.14", 46 | "@langchain/core": "^0.1.8", 47 | "highlight.js": "^11.9.0", 48 | "marked": "^11.1.1", 49 | "marked-highlight": "^2.1.0" 50 | } 51 | } -------------------------------------------------------------------------------- /postcss.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } -------------------------------------------------------------------------------- /src/app.d.ts: -------------------------------------------------------------------------------- 1 | // See https://kit.svelte.dev/docs/types#app 2 | // for information about these interfaces 3 | // and what to do when importing types 4 | declare namespace App { 5 | // interface Locals {} 6 | // interface PageData {} 7 | // interface Error {} 8 | // interface Platform {} 9 | } 10 | -------------------------------------------------------------------------------- /src/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %sveltekit.head% 8 | 9 | 10 |
%sveltekit.body%
11 | 12 | 13 | -------------------------------------------------------------------------------- /src/app.postcss: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | @tailwind variants; 5 | -------------------------------------------------------------------------------- /src/lib/index.ts: -------------------------------------------------------------------------------- 1 | // place files you want to import through the `$lib` alias in this folder. 2 | -------------------------------------------------------------------------------- /src/lib/interfaces/api.ts: -------------------------------------------------------------------------------- 1 | export interface API { 2 | method: string 3 | path: string 4 | requestExample: string 5 | responseExample: string 6 | description: string 7 | } 8 | -------------------------------------------------------------------------------- /src/lib/interfaces/generate.ts: -------------------------------------------------------------------------------- 1 | import type { API } from "./api" 2 | 3 | export interface GenerateRequest { 4 | language: string 5 | framework?: string 6 | etc?: string 7 | modelSchema?: string 8 | apis: API[] 9 | } 10 | -------------------------------------------------------------------------------- /src/routes/+layout.svelte: -------------------------------------------------------------------------------- 1 | 56 | 57 |
58 | 59 |
60 | -------------------------------------------------------------------------------- /src/routes/+layout.ts: -------------------------------------------------------------------------------- 1 | export const ssr = false; 2 | export const prerender = true; 3 | -------------------------------------------------------------------------------- /src/routes/+page.css: -------------------------------------------------------------------------------- 1 | p { 2 | margin-bottom: 2rem !important; 3 | } 4 | 5 | ol { 6 | padding-left: 40px !important; 7 | margin-top: 2rem !important; 8 | margin-bottom: 2rem !important; 9 | list-style: decimal !important; 10 | } 11 | 12 | ul { 13 | padding-left: 40px !important; 14 | margin-top: 2rem !important; 15 | margin-bottom: 2rem !important; 16 | list-style: disc !important; 17 | } 18 | 19 | li { 20 | margin-bottom: 0.5rem !important; 21 | } 22 | 23 | pre { 24 | margin-bottom: 2rem !important; 25 | text-wrap: wrap !important; 26 | } 27 | -------------------------------------------------------------------------------- /src/routes/+page.svelte: -------------------------------------------------------------------------------- 1 | 122 | 123 |
124 |
125 | 129 | 130 | 134 |
135 | 136 |