create-tinybase 0.2.0 → 0.2.2

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 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,240 @@
1
+ # create-tinybase
2
+
3
+ A CLI tool to scaffold a new TinyBase application with full synchronization and
4
+ local-first capabilities.
5
+
6
+ Build a todo list, a drawing app, a chat app, or a tic-tac-toe game using
7
+ TypeScript or JavaScript, with React or Vanilla JS - in just a matter of
8
+ seconds.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ npm create tinybase
14
+ ```
15
+
16
+ (PNPM, Yarn, and Bun should also work!)
17
+
18
+ This will prompt you with questions to configure your new TinyBase app:
19
+
20
+ - **Project name** - Name of your project directory
21
+ - **Language** - TypeScript or JavaScript
22
+ - **Framework** - React or Vanilla JS
23
+ - **App type** - Todo app, Chat app, Drawing app, or Tic-tac-toe game
24
+ - **Store schemas** - TypeScript type safety for stores (TypeScript only)
25
+ - **Synchronization** - Enable real-time sync between clients
26
+ - **Server code** - Include Node.js or Cloudflare Durable Objects server
27
+ - **Prettier** - Include Prettier for code formatting
28
+ - **ESLint** - Include ESLint for code linting
29
+
30
+ After creating your project:
31
+
32
+ ```bash
33
+ cd my-tinybase-app/client
34
+ npm install
35
+ npm run dev
36
+ ```
37
+
38
+ Your app will be available at `http://localhost:5173`, or whichever port Vite
39
+ specifies in the console.
40
+
41
+ If you included server code, start the server in a separate terminal:
42
+
43
+ ```bash
44
+ # In a separate terminal
45
+ cd my-tinybase-app/server
46
+ npm install
47
+ npm run dev
48
+ ```
49
+
50
+ You can also concurrently run both client and server using `npm run dev` in the
51
+ parent directory.
52
+
53
+ Your app should look something like this:
54
+
55
+ ### Todo App
56
+
57
+ ![Todo App](screenshots/todos.png)
58
+
59
+ - Task list with add/complete/delete
60
+ - Single store for todos
61
+ - Demonstrates basic CRUD operations
62
+ - Perfect starter example
63
+
64
+ ### Chat App
65
+
66
+ ![Chat App](screenshots/chat.png)
67
+
68
+ - Multi-user messaging interface
69
+ - Dual stores: settings + messages
70
+ - Username configuration
71
+ - Real-time message sync
72
+
73
+ ### Drawing App
74
+
75
+ ![Drawing App](screenshots/drawing.png)
76
+
77
+ - Collaborative drawing canvas
78
+ - Brush size and color controls
79
+ - Dual stores: settings + canvas
80
+ - Optimized point-based stroke storage
81
+
82
+ ### Tic-tac-toe Game
83
+
84
+ ![Tic-tac-toe Game](screenshots/game.png)
85
+
86
+ - Two-player game board
87
+ - Win/draw detection
88
+ - Turn management
89
+ - Game state synchronization
90
+
91
+ ## Configuration Options
92
+
93
+ During the prompts, you can customize various aspects of your TinyBase app. Here
94
+ are the details of what each option entails:
95
+
96
+ ### Language Choice
97
+
98
+ **TypeScript** provides full type safety with:
99
+
100
+ - Typed store schemas (optional)
101
+ - IntelliSense support for TinyBase APIs
102
+ - Compile-time error checking
103
+ - Better IDE integration
104
+
105
+ **JavaScript** offers:
106
+
107
+ - Faster setup with no transpilation step
108
+ - Simpler learning curve
109
+ - Still fully functional with TinyBase
110
+
111
+ ### Framework Choice
112
+
113
+ **React** provides:
114
+
115
+ - Component-based architecture
116
+ - React hooks for TinyBase stores
117
+ - Automatic re-rendering on store updates
118
+ - Full ecosystem support
119
+
120
+ **Vanilla JS** offers:
121
+
122
+ - No framework dependencies
123
+ - Smaller bundle size
124
+ - Direct DOM manipulation
125
+ - Manual listener-based updates
126
+
127
+ ### App Types
128
+
129
+ - **Todo App** - Simple task management with add, edit, delete features
130
+ - **Chat App** - Real-time messaging between multiple clients
131
+ - **Drawing App** - Collaborative canvas with basic drawing tools
132
+ - **Tic-Tac-Toe Game** - Two-player game with real-time updates
133
+
134
+ ### Store Schemas (TypeScript Only)
135
+
136
+ When enabled, schemas provide:
137
+
138
+ - Full TypeScript typing for store structure
139
+ - Runtime validation
140
+ - Better autocomplete
141
+ - Type-safe data access
142
+
143
+ Schemas define:
144
+
145
+ - Table structures with cell types
146
+ - Value types
147
+ - Default values
148
+ - Strict typing for all store operations
149
+
150
+ ### Synchronization
151
+
152
+ **Enabled** (default):
153
+
154
+ - Real-time sync between browser tabs
155
+ - WebSocket-based synchronization
156
+ - Connects to demo server by default (wss://vite.tinybase.org)
157
+ - MergeableStore for conflict-free replication
158
+ - Automatic reconnection handling
159
+
160
+ **Disabled**:
161
+
162
+ - Local-only data storage
163
+ - No network dependencies
164
+ - Simpler architecture
165
+ - Still uses MergeableStore for consistency
166
+
167
+ ### Server Code
168
+
169
+ When synchronization is enabled, you can include server code:
170
+
171
+ **Node.js Server** (port 8043):
172
+
173
+ - WebSocket server using `ws` library
174
+ - TinyBase server synchronizer
175
+ - Runs with `npm run dev` in server directory
176
+ - Easy to deploy to any Node.js host
177
+
178
+ **Cloudflare Durable Objects** (port 8787):
179
+
180
+ - Serverless WebSocket server
181
+ - Edge computing with Durable Objects
182
+ - Global distribution
183
+ - Runs locally with Wrangler
184
+
185
+ **No Server**:
186
+
187
+ - Connects to public demo server
188
+ - Great for prototyping
189
+ - No local server management needed
190
+
191
+ ### Prettier & ESLint
192
+
193
+ **Prettier**:
194
+
195
+ - Automatic code formatting
196
+ - Consistent style across project
197
+ - Pre-configured settings
198
+ - Runs on save (with IDE integration)
199
+
200
+ **ESLint**:
201
+
202
+ - Code quality checks
203
+ - Catch common errors
204
+ - Import organization
205
+ - TypeScript-aware rules
206
+
207
+ ## Project Structure
208
+
209
+ All apps are created with a monorepo structure:
210
+
211
+ ```
212
+ my-tinybase-app/
213
+ ├── package.json # Root package (manages workspaces)
214
+ ├── README.md # Getting started guide
215
+ ├── client/ # Client application
216
+ │ ├── package.json # Client dependencies
217
+ │ ├── index.html # Entry HTML
218
+ │ ├── public/ # Static assets
219
+ │ └── src/ # Source code
220
+ │ ├── App.tsx # Main app component
221
+ │ ├── Store.tsx # TinyBase store setup
222
+ │ └── ... # App-specific components
223
+ └── server/ # Server code (optional)
224
+ ├── package.json # Server dependencies
225
+ └── src/
226
+ └── index.ts # Server entry point
227
+ ```
228
+
229
+ ## Learn More
230
+
231
+ - [TinyBase Documentation](https://tinybase.org)
232
+ - [TinyBase GitHub](https://github.com/tinyplex/tinybase)
233
+ - [Synchronization Guide](https://tinybase.org/guides/synchronization)
234
+ - [React Integration](https://tinybase.org/guides/building-uis/using-react)
235
+
236
+ ## License
237
+
238
+ MIT License - see
239
+ [LICENSE](https://github.com/tinyplex/tinybase/blob/main/LICENSE) file for
240
+ details.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "create-tinybase",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "author": "jamesgpearce",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/tinyplex/tinybase.git"
7
+ "url": "git+https://github.com/tinyplex/create-tinybase.git"
8
8
  },
9
9
  "license": "MIT",
10
10
  "homepage": "https://tinybase.org",
@@ -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