create-tinybase 0.2.0 → 0.2.1
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.
- package/LICENSE +21 -0
- package/README.md +227 -0
- package/package.json +5 -2
- package/screenshots/chat.png +0 -0
- package/screenshots/drawing.png +0 -0
- package/screenshots/game.png +0 -0
- package/screenshots/todos.png +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) James Pearce, 2025 -
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# create-tinybase
|
|
2
|
+
|
|
3
|
+
A CLI tool to scaffold a new TinyBase application with full synchronization and local-first capabilities.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm init tinybase
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This will prompt you with questions to configure your new TinyBase app:
|
|
12
|
+
|
|
13
|
+
- **Project name** - Name of your project directory
|
|
14
|
+
- **Language** - TypeScript or JavaScript
|
|
15
|
+
- **Framework** - React or Vanilla JS
|
|
16
|
+
- **App type** - Todo app, Chat app, Drawing app, or Tic-tac-toe game
|
|
17
|
+
- **Store schemas** - TypeScript type safety for stores (TypeScript only)
|
|
18
|
+
- **Synchronization** - Enable real-time sync between clients
|
|
19
|
+
- **Server code** - Include Node.js or Cloudflare Durable Objects server
|
|
20
|
+
- **Prettier** - Include Prettier for code formatting
|
|
21
|
+
- **ESLint** - Include ESLint for code linting
|
|
22
|
+
|
|
23
|
+
After creating your project:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cd my-tinybase-app/client
|
|
27
|
+
npm install
|
|
28
|
+
npm run dev
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If you included server code:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# In a separate terminal
|
|
35
|
+
cd my-tinybase-app/server
|
|
36
|
+
npm install
|
|
37
|
+
npm run dev
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Your app will be available at `http://localhost:5173`
|
|
41
|
+
|
|
42
|
+
## Features
|
|
43
|
+
|
|
44
|
+
- ⚡ **Fast Setup** - Get started in seconds with Vite
|
|
45
|
+
- 🔄 **Real-time Sync** - Built-in synchronization support
|
|
46
|
+
- 🎨 **Four Demo Apps** - Learn from complete examples
|
|
47
|
+
- 📦 **Zero Config** - Works out of the box
|
|
48
|
+
- 🔧 **Fully Customizable** - Modify templates to your needs
|
|
49
|
+
- 🌐 **Local-First** - Offline-capable by default
|
|
50
|
+
- 🔐 **Type-Safe** - Optional TypeScript schemas
|
|
51
|
+
|
|
52
|
+
## Configuration Guide
|
|
53
|
+
|
|
54
|
+
### Language Choice
|
|
55
|
+
|
|
56
|
+
**TypeScript** provides full type safety with:
|
|
57
|
+
|
|
58
|
+
- Typed store schemas (optional)
|
|
59
|
+
- IntelliSense support for TinyBase APIs
|
|
60
|
+
- Compile-time error checking
|
|
61
|
+
- Better IDE integration
|
|
62
|
+
|
|
63
|
+
**JavaScript** offers:
|
|
64
|
+
|
|
65
|
+
- Faster setup with no transpilation step
|
|
66
|
+
- Simpler learning curve
|
|
67
|
+
- Still fully functional with TinyBase
|
|
68
|
+
|
|
69
|
+
### Framework Choice
|
|
70
|
+
|
|
71
|
+
**React** provides:
|
|
72
|
+
|
|
73
|
+
- Component-based architecture
|
|
74
|
+
- React hooks for TinyBase stores
|
|
75
|
+
- Automatic re-rendering on store updates
|
|
76
|
+
- Full ecosystem support
|
|
77
|
+
|
|
78
|
+
**Vanilla JS** offers:
|
|
79
|
+
|
|
80
|
+
- No framework dependencies
|
|
81
|
+
- Smaller bundle size
|
|
82
|
+
- Direct DOM manipulation
|
|
83
|
+
- Manual listener-based updates
|
|
84
|
+
|
|
85
|
+
### App Types
|
|
86
|
+
|
|
87
|
+
#### Todo App
|
|
88
|
+
|
|
89
|
+

|
|
90
|
+
|
|
91
|
+
- Task list with add/complete/delete
|
|
92
|
+
- Single store for todos
|
|
93
|
+
- Demonstrates basic CRUD operations
|
|
94
|
+
- Perfect starter example
|
|
95
|
+
|
|
96
|
+
#### Chat App
|
|
97
|
+
|
|
98
|
+

|
|
99
|
+
|
|
100
|
+
- Multi-user messaging interface
|
|
101
|
+
- Dual stores: settings + messages
|
|
102
|
+
- Username configuration
|
|
103
|
+
- Real-time message sync
|
|
104
|
+
|
|
105
|
+
#### Drawing App
|
|
106
|
+
|
|
107
|
+

|
|
108
|
+
|
|
109
|
+
- Collaborative drawing canvas
|
|
110
|
+
- Brush size and color controls
|
|
111
|
+
- Dual stores: settings + canvas
|
|
112
|
+
- Optimized point-based stroke storage
|
|
113
|
+
|
|
114
|
+
#### Tic-tac-toe Game
|
|
115
|
+
|
|
116
|
+

|
|
117
|
+
|
|
118
|
+
- Two-player game board
|
|
119
|
+
- Win/draw detection
|
|
120
|
+
- Turn management
|
|
121
|
+
- Game state synchronization
|
|
122
|
+
|
|
123
|
+
### Store Schemas (TypeScript Only)
|
|
124
|
+
|
|
125
|
+
When enabled, schemas provide:
|
|
126
|
+
|
|
127
|
+
- Full TypeScript typing for store structure
|
|
128
|
+
- Runtime validation
|
|
129
|
+
- Better autocomplete
|
|
130
|
+
- Type-safe data access
|
|
131
|
+
|
|
132
|
+
Schemas define:
|
|
133
|
+
|
|
134
|
+
- Table structures with cell types
|
|
135
|
+
- Value types
|
|
136
|
+
- Default values
|
|
137
|
+
- Strict typing for all store operations
|
|
138
|
+
|
|
139
|
+
### Synchronization
|
|
140
|
+
|
|
141
|
+
**Enabled** (default):
|
|
142
|
+
|
|
143
|
+
- Real-time sync between browser tabs
|
|
144
|
+
- WebSocket-based synchronization
|
|
145
|
+
- Connects to demo server by default (wss://vite.tinybase.org)
|
|
146
|
+
- MergeableStore for conflict-free replication
|
|
147
|
+
- Automatic reconnection handling
|
|
148
|
+
|
|
149
|
+
**Disabled**:
|
|
150
|
+
|
|
151
|
+
- Local-only data storage
|
|
152
|
+
- No network dependencies
|
|
153
|
+
- Simpler architecture
|
|
154
|
+
- Still uses MergeableStore for consistency
|
|
155
|
+
|
|
156
|
+
### Server Code
|
|
157
|
+
|
|
158
|
+
When synchronization is enabled, you can include server code:
|
|
159
|
+
|
|
160
|
+
**Node.js Server** (port 8043):
|
|
161
|
+
|
|
162
|
+
- WebSocket server using `ws` library
|
|
163
|
+
- TinyBase server synchronizer
|
|
164
|
+
- Runs with `npm run dev` in server directory
|
|
165
|
+
- Easy to deploy to any Node.js host
|
|
166
|
+
|
|
167
|
+
**Cloudflare Durable Objects** (port 8787):
|
|
168
|
+
|
|
169
|
+
- Serverless WebSocket server
|
|
170
|
+
- Edge computing with Durable Objects
|
|
171
|
+
- Global distribution
|
|
172
|
+
- Runs locally with Wrangler
|
|
173
|
+
|
|
174
|
+
**No Server**:
|
|
175
|
+
|
|
176
|
+
- Connects to public demo server
|
|
177
|
+
- Great for prototyping
|
|
178
|
+
- No local server management needed
|
|
179
|
+
|
|
180
|
+
### Prettier & ESLint
|
|
181
|
+
|
|
182
|
+
**Prettier**:
|
|
183
|
+
|
|
184
|
+
- Automatic code formatting
|
|
185
|
+
- Consistent style across project
|
|
186
|
+
- Pre-configured settings
|
|
187
|
+
- Runs on save (with IDE integration)
|
|
188
|
+
|
|
189
|
+
**ESLint**:
|
|
190
|
+
|
|
191
|
+
- Code quality checks
|
|
192
|
+
- Catch common errors
|
|
193
|
+
- Import organization
|
|
194
|
+
- TypeScript-aware rules
|
|
195
|
+
|
|
196
|
+
## Project Structure
|
|
197
|
+
|
|
198
|
+
All apps are created with a monorepo structure:
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
my-tinybase-app/
|
|
202
|
+
├── package.json # Root package (manages workspaces)
|
|
203
|
+
├── README.md # Getting started guide
|
|
204
|
+
├── client/ # Client application
|
|
205
|
+
│ ├── package.json # Client dependencies
|
|
206
|
+
│ ├── index.html # Entry HTML
|
|
207
|
+
│ ├── public/ # Static assets
|
|
208
|
+
│ └── src/ # Source code
|
|
209
|
+
│ ├── App.tsx # Main app component
|
|
210
|
+
│ ├── Store.tsx # TinyBase store setup
|
|
211
|
+
│ └── ... # App-specific components
|
|
212
|
+
└── server/ # Server code (optional)
|
|
213
|
+
├── package.json # Server dependencies
|
|
214
|
+
└── src/
|
|
215
|
+
└── index.ts # Server entry point
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Learn More
|
|
219
|
+
|
|
220
|
+
- [TinyBase Documentation](https://tinybase.org)
|
|
221
|
+
- [TinyBase GitHub](https://github.com/tinyplex/tinybase)
|
|
222
|
+
- [Synchronization Guide](https://tinybase.org/guides/synchronization)
|
|
223
|
+
- [React Integration](https://tinybase.org/guides/building-uis/using-react)
|
|
224
|
+
|
|
225
|
+
## License
|
|
226
|
+
|
|
227
|
+
MIT License - see [LICENSE](https://github.com/tinyplex/tinybase/blob/main/LICENSE) file for details.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-tinybase",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"cli.js",
|
|
33
|
-
"templates"
|
|
33
|
+
"templates",
|
|
34
|
+
"screenshots",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE"
|
|
34
37
|
]
|
|
35
38
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|