├── .gitattributes
├── .gitignore
├── DEVELOPMENT.md
├── README.md
├── eslint.config.mjs
├── package-lock.json
├── package.json
├── src
└── main.ts
├── templates
├── .DS_Store
└── basic-tw
│ ├── .DS_Store
│ ├── README.md
│ ├── basic.config.ts
│ ├── eslint.config.js
│ ├── index.html
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ └── vite.svg
│ ├── src
│ ├── App.css
│ ├── App.tsx
│ ├── assets
│ │ └── react.svg
│ ├── index.css
│ ├── main.tsx
│ └── vite-env.d.ts
│ ├── tsconfig.app.json
│ ├── tsconfig.json
│ ├── tsconfig.node.json
│ └── vite.config.ts
├── tsconfig.json
├── tsup.config.ts
└── vitest.config.mts
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | dist/
3 |
--------------------------------------------------------------------------------
/DEVELOPMENT.md:
--------------------------------------------------------------------------------
1 | # Development Guide
2 |
3 | This document contains instructions for developing and maintaining `create-lofi-app`.
4 |
5 | ## Local Development
6 |
7 | 1. Clone the repository:
8 | ```bash
9 | git clone https://github.com/yourusername/create-lofi-app.git
10 | cd create-lofi-app
11 | ```
12 |
13 | 2. Install dependencies:
14 | ```bash
15 | npm install
16 | ```
17 |
18 | 3. Make your changes to the source code in `src/`
19 |
20 | 4. Build and test locally:
21 | ```bash
22 | npm run build
23 | npm link
24 | npx create-lofi-app test-app
25 | ```
26 |
27 | ## Testing
28 |
29 | Run the test suite:
30 | ```bash
31 | npm test
32 | ```
33 |
34 | ## Publishing to npm
35 |
36 | ### Preparing a Release
37 |
38 | 1. Update version in `package.json`:
39 | ```bash
40 | npm version patch # for bug fixes
41 | npm version minor # for new features
42 | npm version major # for breaking changes
43 | ```
44 |
45 | This will:
46 | - Update the version in package.json
47 | - Create a git tag
48 | - Create a version commit
49 |
50 | ### Building and Publishing
51 |
52 | 1. Build the package:
53 | ```bash
54 | npm run build
55 | ```
56 |
57 | 2. Test the build locally (recommended):
58 | ```bash
59 | npm link
60 | npx create-lofi-app test-app
61 | ```
62 |
63 | 3. Publish to npm:
64 | ```bash
65 | npm login # if not already logged in
66 | npm publish
67 | ```
68 |
69 | 4. Push the release to GitHub:
70 | ```bash
71 | git push --follow-tags
72 | ```
73 |
74 | ## Project Structure
75 |
76 | ```
77 | create-lofi-app/
78 | ├── src/ # Source code for the CLI
79 | ├── templates/ # Project templates
80 | │ └── basic-tw/ # Basic template with Tailwind
81 | ├── tests/ # Test files
82 | └── package.json # Project configuration
83 | ```
84 |
85 | ## Template Development
86 |
87 | When modifying the templates:
88 |
89 | 1. Make changes in `templates/` directory
90 | 2. Test locally using `npm link`
91 | 3. Verify the template works with:
92 | ```bash
93 | npx create-lofi-app test-app
94 | cd test-app
95 | npm install
96 | npm run dev
97 | ```
98 |
99 | ## Common Issues
100 |
101 | - If `npm link` fails, try removing the global link first:
102 | ```bash
103 | npm unlink -g create-lofi-app
104 | ```
105 |
106 | - If you get permission errors when publishing:
107 | ```bash
108 | npm whoami # verify you're logged in
109 | npm access ls-collaborators create-lofi-app # check access rights
110 | ```
111 |
112 | ## Build Configuration
113 |
114 | ### tsup
115 |
116 | The build process uses tsup to bundle the CLI. This is configured in `tsup.config.ts`:
117 |
118 | ```ts
119 | export default defineConfig({
120 | entry: ['src/main.ts'],
121 | format: ['cjs', 'esm'], // Build both CommonJS and ES Modules
122 | dts: true, // Generate TypeScript declarations
123 | clean: true, // Clean dist folder before build
124 | splitting: false, // Don't split chunks
125 | sourcemap: true, // Generate sourcemaps
126 | copyFiles: {
127 | 'templates': 'dist/templates' // Copy template files to dist
128 | }
129 | })
130 | ```
131 |
132 | Important `package.json` fields for publishing:
133 | ```json
134 | {
135 | "main": "dist/main.js", // CommonJS entry
136 | "module": "dist/main.mjs", // ES Module entry
137 | "types": "dist/main.d.ts", // TypeScript types
138 | "files": [ // Files to include in npm package
139 | "dist",
140 | "templates"
141 | ]
142 | }
143 | ```
144 |
145 | Make sure to:
146 | - Test both CJS and ESM builds
147 | - Verify template files are copied correctly
148 | - Check TypeScript declarations are generated
149 | - Ensure sourcemaps are working
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # create-lofi-app
2 |
3 |
4 |
5 | 🚀 A powerful starter kit for building local-first applications
6 |
7 | [](https://github.com/yourusername/create-lofi-app)
8 | [](https://github.com/basicdb/create-lofi-app/pulls)
9 |
10 | ⚠️ **Beta Notice**: This project is in beta stage. While it's stable enough for experimentation and early projects, expect some rough edges. We welcome your feedback and contributions!
11 |
12 |
13 |
14 | ## 🌟 What is create-lofi-app?
15 |
16 | create-lofi-app is an opinionated starter kit designed to make local-first development accessible and enjoyable. It provides everything you need to build modern, offline-capable applications that prioritize user data ownership and privacy.
17 |
18 | ### 🎯 Perfect for:
19 | - Building offline-first web applications
20 | - Creating privacy-focused tools
21 | - Developing collaborative applications
22 | - Prototyping local-first ideas quickly
23 |
24 | ## ✨ Features
25 |
26 | - 🚀 **Lightning Fast Development** with [Vite](https://vitejs.dev/)
27 | - ⚛️ **Modern React** ([React 19](https://react.dev/)) with TypeScript support
28 | - 🛣️ **Seamless Routing** via [React Router](https://reactrouter.com/)
29 | - 💅 **Beautiful Styling** with [Tailwind CSS](https://tailwindcss.com/)
30 | - 📱 **PWA Ready** using [Vite-PWA](https://vite-pwa-org.netlify.app/guide/)
31 | - 💾 **Local-First Database** powered by [Basic](https://docs.basic.tech)
32 | - 🔄 **Built-in Sync Layer** for seamless data synchronization
33 | - 📦 **Zero Configuration** - just create and start building
34 |
35 | ## 🚀 Getting Started
36 |
37 | ### Quick Start
38 |
39 | ```bash
40 | # Create a new app
41 | npx create-lofi-app my-app
42 |
43 | # Navigate to your project
44 | cd my-app
45 |
46 | # Install dependencies
47 | npm install
48 |
49 | # Start development server
50 | npm run dev
51 | ```
52 |
53 | Visit `http://localhost:5173` to see your app in action!
54 |
55 | ## 📁 Project Structure
56 |
57 | ```
58 | my-app/
59 | ├── src/
60 | │ ├── assets/ # Static assets (images, fonts, etc.)
61 | │ ├── components/ # Reusable React components
62 | │ ├── pages/ # Application pages/routes
63 | │ ├── App.tsx # Main application component
64 | │ └── main.tsx # Application entry point
65 | ├── public/ # Public static assets
66 | ├── index.html # HTML template
67 | └── basic.config.ts # Basic database configuration
68 | ```
69 |
70 | ## 🏗️ Building for Production
71 |
72 | ```bash
73 | # Create production build
74 | npm run build
75 |
76 | # Preview production build
77 | npm run preview
78 | ```
79 |
80 | ## 🤔 Why Local-First?
81 |
82 | Local-first applications represent a paradigm shift in web development, offering numerous advantages:
83 |
84 | ### Key Benefits:
85 | - 🔒 **Enhanced Privacy**: User data stays on their device by default
86 | - ⚡ **Superior Performance**: No network latency for data operations
87 | - 📴 **Offline Capability**: Full functionality without internet
88 | - 🤝 **Data Ownership**: Users have complete control over their information
89 | - 🔄 **Optional Sync**: Cloud synchronization when needed
90 |
91 | ## 🤝 Contributing
92 |
93 | We love contributions! Whether it's:
94 | - 🐛 Bug reports
95 | - 💡 Feature suggestions
96 | - 📝 Documentation improvements
97 | - 🔧 Pull requests
98 |
99 | Please feel free to contribute to make create-lofi-app better for everyone!
100 |
101 | ## 📚 Documentation
102 |
103 | For detailed documentation and guides, visit:
104 | - [Basic Documentation](https://docs.basic.tech)
105 | - [Getting Started Guide](https://docs.basic.tech/get-started/implement-basic/create-lofi-app)
106 | - [API Reference](https://docs.basic.tech/api-reference/auth/authorize)
107 |
108 | ---
109 |
110 |
111 |
112 | Made with ❤️ by the create-lofi-app team
113 |
114 | ⭐ Star us on GitHub | [Report an Issue](https://github.com/basicdb/create-lofi-app/issues)
115 |
116 |
4 |
5 | Built with create-lofi-app - A Modern Local-First Application Template
6 |
7 | [](https://github.com/basicdb/create-lofi-app)
8 |
9 |
10 |
11 | ## ✨ Features
12 |
13 | This app is / has:
14 |
15 | - 🔄 **Local-First Architecture** powered by [Basic](https://docs.basic.tech)
16 | - ⚛️ **Modern React** (v19) with TypeScript
17 | - 🛣️ **Seamless Routing** with React Router v7
18 | - 💅 **Beautiful UI** with Tailwind CSS & Shadcn/UI
19 | - 📱 **PWA Ready** - works offline and can be installed
20 | - 🔒 **Privacy Focused** - data stays on user's device
21 |
22 | ## 🛠️ Getting Started
23 |
24 | ### Prerequisites
25 |
26 | - Node.js 16.x or later
27 | - npm 7.x or later
28 |
29 | ### Installation
30 |
31 | 1. Clone the repository:
32 | ```bash
33 | git clone [your-repo-url]
34 | cd [your-repo-name]
35 | ```
36 |
37 | 2. Install dependencies:
38 | ```bash
39 | npm install
40 | ```
41 |
42 | 3. Start the development server:
43 | ```bash
44 | npm run dev
45 | ```
46 |
47 | Visit `http://localhost:5173` to see your app running!
48 |
49 | ## 📁 Project Structure
50 |
51 | ```
52 | ├── src/
53 | │ ├── components/ # Reusable React components
54 | │ ├── pages/ # Application routes/pages
55 | │ ├── App.tsx # Main application component
56 | │ └── main.tsx # Application entry point
57 | ├── public/ # Static assets
58 | └── basic.config.ts # Basic database configuration
59 | ```
60 |
61 | ## 🚀 Deployment
62 |
63 | 1. Build the application:
64 | ```bash
65 | npm run build
66 | ```
67 |
68 | 2. Preview the production build:
69 | ```bash
70 | npm run preview
71 | ```
72 |
73 | The `dist` folder will contain your optimized production build.
74 |
75 | ## 🔧 Configuration
76 |
77 | ### Basic Database
78 |
79 | Edit `basic.config.ts` to configure your database schema:
80 |
81 | ```typescript
82 | export const schema = {
83 | project_id: '[your-project-id]',
84 | version: 0,
85 | tables: {
86 | // Define your collections here
87 | }
88 | }
89 | ```
90 |
91 | ### PWA Settings
92 |
93 | PWA features can be configured in `vite.config.ts`. See the [Vite PWA documentation](https://vite-pwa-org.netlify.app/) for more details.
94 |
95 | ## 📚 Learn More
96 |
97 | - [Basic Documentation](https://docs.basic.tech)
98 | - [Vite Guide](https://vitejs.dev/guide/)
99 | - [React Documentation](https://react.dev)
100 | - [Tailwind CSS](https://tailwindcss.com/docs)
101 | - [React Router](https://reactrouter.com/docs)
102 |
103 | ## 📝 License
104 |
105 | ---
106 |
107 |
108 | Made with ❤️ using [create-lofi-app](https://github.com/basicdb/create-lofi-app)
109 |