@codecanvascollective/scaffold 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -0
  3. package/dist/chunk-2A65KFCS.js +76 -0
  4. package/dist/chunk-2A65KFCS.js.map +1 -0
  5. package/dist/file-5IKT7CEX.js +24 -0
  6. package/dist/file-5IKT7CEX.js.map +1 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.js +833 -0
  9. package/dist/index.js.map +1 -0
  10. package/package.json +70 -0
  11. package/src/templates/angular/base/angular.json.hbs +35 -0
  12. package/src/templates/angular/base/package.json.hbs +36 -0
  13. package/src/templates/angular/base/src/app/app.component.ts.hbs +19 -0
  14. package/src/templates/angular/base/src/app/app.config.ts.hbs +5 -0
  15. package/src/templates/angular/base/src/main.ts.hbs +7 -0
  16. package/src/templates/angular/base/tsconfig.json.hbs +26 -0
  17. package/src/templates/express/base/package.json.hbs +32 -0
  18. package/src/templates/express/base/src/index.ts.hbs +20 -0
  19. package/src/templates/express/base/src/middleware/errorHandler.ts.hbs +15 -0
  20. package/src/templates/express/base/src/routes/index.ts.hbs +11 -0
  21. package/src/templates/express/base/tsconfig.json.hbs +18 -0
  22. package/src/templates/express/with-prisma/prisma/schema.prisma.hbs +16 -0
  23. package/src/templates/express/with-prisma/prisma/seed.ts.hbs +27 -0
  24. package/src/templates/express/with-prisma/src/lib/db.ts.hbs +11 -0
  25. package/src/templates/fastapi/base/app/main.py.hbs +13 -0
  26. package/src/templates/fastapi/base/app/models/__init__.py.hbs +1 -0
  27. package/src/templates/fastapi/base/app/routes/__init__.py.hbs +1 -0
  28. package/src/templates/fastapi/base/pyproject.toml.hbs +8 -0
  29. package/src/templates/fastapi/base/requirements.txt.hbs +7 -0
  30. package/src/templates/nextjs/base/next.config.ts.hbs +5 -0
  31. package/src/templates/nextjs/base/package.json.hbs +33 -0
  32. package/src/templates/nextjs/base/src/app/globals.css.hbs +22 -0
  33. package/src/templates/nextjs/base/src/app/layout.tsx.hbs +19 -0
  34. package/src/templates/nextjs/base/src/app/page.tsx.hbs +8 -0
  35. package/src/templates/nextjs/base/tsconfig.json.hbs +25 -0
  36. package/src/templates/nextjs/with-auth/src/app/api/auth/[...nextauth]/route.ts.hbs +6 -0
  37. package/src/templates/nextjs/with-auth/src/lib/auth.ts.hbs +14 -0
  38. package/src/templates/nextjs/with-prisma/prisma/schema.prisma.hbs +16 -0
  39. package/src/templates/nextjs/with-prisma/prisma/seed.ts.hbs +27 -0
  40. package/src/templates/nextjs/with-prisma/src/lib/db.ts.hbs +11 -0
  41. package/src/templates/react/base/index.html.hbs +12 -0
  42. package/src/templates/react/base/package.json.hbs +36 -0
  43. package/src/templates/react/base/src/App.tsx.hbs +10 -0
  44. package/src/templates/react/base/src/index.css.hbs +17 -0
  45. package/src/templates/react/base/src/main.tsx.hbs +10 -0
  46. package/src/templates/react/base/tests/App.test.tsx.hbs +10 -0
  47. package/src/templates/react/base/tsconfig.json.hbs +16 -0
  48. package/src/templates/react/base/vite.config.ts.hbs +13 -0
  49. package/src/templates/react/with-shadcn/components.json.hbs +16 -0
  50. package/src/templates/react/with-shadcn/src/lib/utils.ts.hbs +6 -0
  51. package/src/templates/react/with-tailwind/postcss.config.js.hbs +6 -0
  52. package/src/templates/react/with-tailwind/src/index.css.hbs +3 -0
  53. package/src/templates/react/with-tailwind/tailwind.config.ts.hbs +9 -0
  54. package/src/templates/shared/docker/Dockerfile.hbs +42 -0
  55. package/src/templates/shared/docker/docker-compose.yml.hbs +30 -0
  56. package/src/templates/shared/eslint.config.js.hbs +17 -0
  57. package/src/templates/shared/github-ci.yml.hbs +58 -0
  58. package/src/templates/shared/gitignore.hbs +36 -0
  59. package/src/templates/shared/license.hbs +21 -0
  60. package/src/templates/shared/prettier.config.js.hbs +7 -0
  61. package/src/templates/shared/readme.md.hbs +43 -0
  62. package/src/templates/shared/tsconfig.base.json.hbs +14 -0
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "preserve",
15
+ "incremental": true,
16
+ "plugins": [
17
+ { "name": "next" }
18
+ ],
19
+ "paths": {
20
+ "@/*": ["./src/*"]
21
+ }
22
+ },
23
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
24
+ "exclude": ["node_modules"]
25
+ }
@@ -0,0 +1,6 @@
1
+ import NextAuth from 'next-auth';
2
+ import { authOptions } from '@/lib/auth';
3
+
4
+ const handler = NextAuth(authOptions);
5
+
6
+ export { handler as GET, handler as POST };
@@ -0,0 +1,14 @@
1
+ import type { NextAuthOptions } from 'next-auth';
2
+ import GithubProvider from 'next-auth/providers/github';
3
+
4
+ export const authOptions: NextAuthOptions = {
5
+ providers: [
6
+ GithubProvider({
7
+ clientId: process.env.GITHUB_ID ?? '',
8
+ clientSecret: process.env.GITHUB_SECRET ?? '',
9
+ }),
10
+ ],
11
+ session: {
12
+ strategy: 'jwt',
13
+ },
14
+ };
@@ -0,0 +1,16 @@
1
+ generator client {
2
+ provider = "prisma-client-js"
3
+ }
4
+
5
+ datasource db {
6
+ provider = "postgresql"
7
+ url = env("DATABASE_URL")
8
+ }
9
+
10
+ model User {
11
+ id String @id @default(cuid())
12
+ email String @unique
13
+ name String?
14
+ createdAt DateTime @default(now())
15
+ updatedAt DateTime @updatedAt
16
+ }
@@ -0,0 +1,27 @@
1
+ import { PrismaClient } from '@prisma/client';
2
+
3
+ const prisma = new PrismaClient();
4
+
5
+ async function main() {
6
+ console.log('Seeding database...');
7
+
8
+ await prisma.user.upsert({
9
+ where: { email: 'admin@example.com' },
10
+ update: {},
11
+ create: {
12
+ email: 'admin@example.com',
13
+ name: 'Admin',
14
+ },
15
+ });
16
+
17
+ console.log('Database seeded.');
18
+ }
19
+
20
+ main()
21
+ .catch((e) => {
22
+ console.error(e);
23
+ process.exit(1);
24
+ })
25
+ .finally(async () => {
26
+ await prisma.$disconnect();
27
+ });
@@ -0,0 +1,11 @@
1
+ import { PrismaClient } from '@prisma/client';
2
+
3
+ const globalForPrisma = globalThis as unknown as {
4
+ prisma: PrismaClient | undefined;
5
+ };
6
+
7
+ export const db = globalForPrisma.prisma ?? new PrismaClient();
8
+
9
+ if (process.env.NODE_ENV !== 'production') {
10
+ globalForPrisma.prisma = db;
11
+ }
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{name}}</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/main.tsx"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "{{name}}",
3
+ "private": true,
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc -b && vite build",
9
+ "preview": "vite preview"{{#if features.testing}},
10
+ "test": "vitest run",
11
+ "test:watch": "vitest"{{/if}}{{#if features.eslint}},
12
+ "lint": "eslint src/"{{/if}}
13
+ },
14
+ "dependencies": {
15
+ "react": "^19.0.0",
16
+ "react-dom": "^19.0.0"
17
+ },
18
+ "devDependencies": {
19
+ "@types/react": "^19.0.0",
20
+ "@types/react-dom": "^19.0.0",
21
+ "@vitejs/plugin-react": "^4.3.0",
22
+ "typescript": "^5.5.0",
23
+ "vite": "^6.0.0"{{#if features.testing}},
24
+ "@testing-library/react": "^16.0.0",
25
+ "@testing-library/jest-dom": "^6.0.0",
26
+ "jsdom": "^25.0.0",
27
+ "vitest": "^2.0.0"{{/if}}{{#if features.eslint}},
28
+ "@eslint/js": "^9.0.0",
29
+ "eslint": "^9.0.0",
30
+ "typescript-eslint": "^8.0.0",
31
+ "prettier": "^3.3.0"{{/if}}{{#if features.tailwind}},
32
+ "tailwindcss": "^3.4.0",
33
+ "postcss": "^8.4.0",
34
+ "autoprefixer": "^10.4.0"{{/if}}
35
+ }
36
+ }
@@ -0,0 +1,10 @@
1
+ function App() {
2
+ return (
3
+ <div>
4
+ <h1>{{name}}</h1>
5
+ <p>Welcome to your new React project!</p>
6
+ </div>
7
+ );
8
+ }
9
+
10
+ export default App;
@@ -0,0 +1,17 @@
1
+ :root {
2
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
3
+ line-height: 1.5;
4
+ font-weight: 400;
5
+ color: #213547;
6
+ background-color: #ffffff;
7
+ }
8
+
9
+ body {
10
+ margin: 0;
11
+ min-height: 100vh;
12
+ }
13
+
14
+ h1 {
15
+ font-size: 3.2em;
16
+ line-height: 1.1;
17
+ }
@@ -0,0 +1,10 @@
1
+ import { StrictMode } from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import App from './App';
4
+ import './index.css';
5
+
6
+ createRoot(document.getElementById('root')!).render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>,
10
+ );
@@ -0,0 +1,10 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { render, screen } from '@testing-library/react';
3
+ import App from '../src/App';
4
+
5
+ describe('App', () => {
6
+ it('renders the project name', () => {
7
+ render(<App />);
8
+ expect(screen.getByText('{{name}}')).toBeDefined();
9
+ });
10
+ });
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "resolveJsonModule": true,
12
+ "jsx": "react-jsx",
13
+ "noEmit": true
14
+ },
15
+ "include": ["src"]
16
+ }
@@ -0,0 +1,13 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ {{#if features.testing}}
7
+ test: {
8
+ globals: true,
9
+ environment: 'jsdom',
10
+ setupFiles: [],
11
+ },
12
+ {{/if}}
13
+ });
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "new-york",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "tailwind.config.ts",
8
+ "css": "src/index.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true
11
+ },
12
+ "aliases": {
13
+ "components": "@/components",
14
+ "utils": "@/lib/utils"
15
+ }
16
+ }
@@ -0,0 +1,6 @@
1
+ import { type ClassValue, clsx } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs));
6
+ }
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
@@ -0,0 +1,9 @@
1
+ import type { Config } from 'tailwindcss';
2
+
3
+ export default {
4
+ content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
5
+ theme: {
6
+ extend: {},
7
+ },
8
+ plugins: [],
9
+ } satisfies Config;
@@ -0,0 +1,42 @@
1
+ {{#if (eq framework "fastapi")}}
2
+ FROM python:3.12-slim
3
+
4
+ WORKDIR /app
5
+
6
+ COPY requirements.txt .
7
+ RUN pip install --no-cache-dir -r requirements.txt
8
+
9
+ COPY . .
10
+
11
+ EXPOSE 8000
12
+
13
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
14
+ {{else}}
15
+ FROM node:20-alpine AS base
16
+
17
+ WORKDIR /app
18
+
19
+ COPY package*.json ./
20
+ RUN npm ci
21
+
22
+ COPY . .
23
+
24
+ {{#if (eq framework "nextjs")}}
25
+ FROM base AS builder
26
+ RUN npm run build
27
+
28
+ FROM node:20-alpine AS runner
29
+ WORKDIR /app
30
+ COPY --from=builder /app/.next/standalone ./
31
+ COPY --from=builder /app/.next/static ./.next/static
32
+ COPY --from=builder /app/public ./public
33
+
34
+ EXPOSE 3000
35
+ CMD ["node", "server.js"]
36
+ {{else}}
37
+ RUN npm run build
38
+
39
+ EXPOSE 3000
40
+ CMD ["node", "dist/index.js"]
41
+ {{/if}}
42
+ {{/if}}
@@ -0,0 +1,30 @@
1
+ services:
2
+ app:
3
+ build: .
4
+ ports:
5
+ {{#if (eq framework "fastapi")}}
6
+ - '8000:8000'
7
+ {{else}}
8
+ - '3000:3000'
9
+ {{/if}}
10
+ environment:
11
+ - NODE_ENV=production
12
+ {{#if (eq variant "with-prisma")}}
13
+ - DATABASE_URL=postgresql://postgres:postgres@db:5432/{{name}}
14
+ depends_on:
15
+ - db
16
+
17
+ db:
18
+ image: postgres:16-alpine
19
+ ports:
20
+ - '5432:5432'
21
+ environment:
22
+ POSTGRES_USER: postgres
23
+ POSTGRES_PASSWORD: postgres
24
+ POSTGRES_DB: {{name}}
25
+ volumes:
26
+ - pgdata:/var/lib/postgresql/data
27
+
28
+ volumes:
29
+ pgdata:
30
+ {{/if}}
@@ -0,0 +1,17 @@
1
+ import js from '@eslint/js';
2
+ import tseslint from 'typescript-eslint';
3
+ {{#if features.tailwind}}
4
+ {{/if}}
5
+
6
+ export default tseslint.config(
7
+ js.configs.recommended,
8
+ ...tseslint.configs.recommended,
9
+ {
10
+ rules: {
11
+ '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
12
+ },
13
+ },
14
+ {
15
+ ignores: ['dist/', 'node_modules/', 'coverage/'],
16
+ },
17
+ );
@@ -0,0 +1,58 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ {{#if (eq framework "fastapi")}}
16
+ python-version: ['3.11', '3.12']
17
+ {{else}}
18
+ node-version: [20, 22]
19
+ {{/if}}
20
+
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ {{#if (eq framework "fastapi")}}
25
+ - name: Set up Python $\{{matrix.python-version}}
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: $\{{matrix.python-version}}
29
+
30
+ - name: Install dependencies
31
+ run: pip install -r requirements.txt
32
+
33
+ {{#if features.testing}}
34
+ - name: Run tests
35
+ run: pytest
36
+ {{/if}}
37
+ {{else}}
38
+ - name: Setup Node.js $\{{matrix.node-version}}
39
+ uses: actions/setup-node@v4
40
+ with:
41
+ node-version: $\{{matrix.node-version}}
42
+
43
+ - name: Install dependencies
44
+ run: {{packageManager}} install
45
+
46
+ {{#if features.eslint}}
47
+ - name: Lint
48
+ run: {{packageManager}} run lint
49
+ {{/if}}
50
+
51
+ - name: Build
52
+ run: {{packageManager}} run build
53
+
54
+ {{#if features.testing}}
55
+ - name: Test
56
+ run: {{packageManager}} run test
57
+ {{/if}}
58
+ {{/if}}
@@ -0,0 +1,36 @@
1
+ # Dependencies
2
+ node_modules/
3
+ __pycache__/
4
+ *.pyc
5
+
6
+ # Build
7
+ dist/
8
+ build/
9
+ .next/
10
+ out/
11
+ .angular/
12
+
13
+ # Environment
14
+ .env
15
+ .env.local
16
+ .env.*.local
17
+
18
+ # IDE
19
+ .vscode/
20
+ .idea/
21
+ *.swp
22
+ *.swo
23
+
24
+ # OS
25
+ .DS_Store
26
+ Thumbs.db
27
+
28
+ # Testing
29
+ coverage/
30
+ .nyc_output/
31
+
32
+ # Misc
33
+ *.log
34
+ npm-debug.log*
35
+ yarn-debug.log*
36
+ yarn-error.log*
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) {{year}} {{name}}
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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "trailingComma": "all",
5
+ "printWidth": 100,
6
+ "tabWidth": 2
7
+ }
@@ -0,0 +1,43 @@
1
+ # {{name}}
2
+
3
+ > Generated with [scaffold](https://github.com/CodeCanvasCollective/scaffold)
4
+
5
+ ## Getting Started
6
+
7
+ {{#if (eq framework "fastapi")}}
8
+ ```bash
9
+ pip install -r requirements.txt
10
+ uvicorn app.main:app --reload
11
+ ```
12
+ {{else}}
13
+ ```bash
14
+ {{packageManager}} install
15
+ {{packageManager}} run dev
16
+ ```
17
+ {{/if}}
18
+
19
+ ## Scripts
20
+
21
+ {{#if (eq framework "fastapi")}}
22
+ | Command | Description |
23
+ |---------|-------------|
24
+ | `uvicorn app.main:app --reload` | Start development server |
25
+ {{#if features.testing}}
26
+ | `pytest` | Run tests |
27
+ {{/if}}
28
+ {{else}}
29
+ | Command | Description |
30
+ |---------|-------------|
31
+ | `{{packageManager}} run dev` | Start development server |
32
+ | `{{packageManager}} run build` | Build for production |
33
+ {{#if features.testing}}
34
+ | `{{packageManager}} run test` | Run tests |
35
+ {{/if}}
36
+ {{#if features.eslint}}
37
+ | `{{packageManager}} run lint` | Lint code |
38
+ {{/if}}
39
+ {{/if}}
40
+
41
+ ## License
42
+
43
+ MIT
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "resolveJsonModule": true,
11
+ "declaration": true,
12
+ "sourceMap": true
13
+ }
14
+ }