create-seamless 0.0.4 → 0.0.6

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 (2) hide show
  1. package/index.js +54 -13
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -72,7 +72,7 @@ const skipGit = hasFlag("no-git");
72
72
 
73
73
  const authPort = getFlag("auth-port", "5312");
74
74
  const apiPort = getFlag("api-port", "3000");
75
- const webPort = getFlag("web-port", "5173");
75
+ const webPort = getFlag("web-port", "5001");
76
76
 
77
77
  const wantsSomething = includeAuth || includeWeb || includeApi;
78
78
  const AUTH = wantsSomething ? includeAuth : true;
@@ -236,46 +236,61 @@ services:
236
236
  ports:
237
237
  - "5432:5432"
238
238
  environment:
239
- POSTGRES_USER: seamless
240
- POSTGRES_PASSWORD: seamless
241
- POSTGRES_DB: seamless
239
+ POSTGRES_USER: myuser
240
+ POSTGRES_PASSWORD: mypassword
241
+ POSTGRES_DB: postgres
242
242
  volumes:
243
243
  - pgdata:/var/lib/postgresql/data
244
+ - ./postgres_init:/docker-entrypoint-initdb.d
245
+ healthcheck:
246
+ test: ["CMD-SHELL", "pg_isready -U myuser -d postgres"]
247
+ interval: 5s
248
+ timeout: 5s
249
+ retries: 5
244
250
 
245
251
  auth:
246
252
  container_name: seamless-auth
247
253
  build: ./auth
248
254
  ports:
249
- - "5312:5312"
255
+ - "${authPort}:${authPort}"
250
256
  env_file:
251
257
  - ./auth/.env
258
+ environment:
259
+ DB_HOST: db
260
+ ISSUER=http://auth:${authPort}
252
261
  volumes:
253
262
  - ./auth:/app
263
+ - /app/node_modules
254
264
  depends_on:
255
- - db
265
+ db:
266
+ condition: service_healthy
256
267
 
257
268
  api:
258
269
  container_name: seamless-api
259
270
  build: ./api
260
271
  ports:
261
- - "3000:3000"
272
+ - "${apiPort}:${apiPort}"
262
273
  env_file:
263
274
  - ./api/.env
275
+ environment:
276
+ AUTH_SERVER_URL=http://auth:${authPort}
264
277
  volumes:
265
278
  - ./api:/app
279
+ - /app/node_modules
266
280
  depends_on:
267
- - auth
268
- - db
281
+ db:
282
+ condition: service_healthy
269
283
 
270
284
  web:
271
285
  container_name: seamless-web
272
286
  build: ./web
273
287
  ports:
274
- - "5001:5001"
288
+ - "${webPort}:${webPort}"
275
289
  env_file:
276
290
  - ./web/.env
277
291
  volumes:
278
292
  - ./web:/app
293
+ - /app/node_modules
279
294
  depends_on:
280
295
  - auth
281
296
  - api
@@ -350,7 +365,12 @@ async function downloadRepo(repo, dest) {
350
365
  DEFAULT_ROLES: "user,betaUser",
351
366
  AVAILABLE_ROLES: "user,admin,betaUser,team",
352
367
 
353
- DATABASE_URL: "postgres://myuser:mypassword@localhost:5432/seamless-auth",
368
+ DB_LOGGING: "false",
369
+ DB_HOST: "localhost",
370
+ DB_PORT: "5432",
371
+ DB_NAME: "seamless_auth",
372
+ DB_USER: "myuser",
373
+ DB_PASSWORD: "mypassword",
354
374
 
355
375
  ACCESS_TOKEN_TTL: "30m",
356
376
  REFRESH_TOKEN_TTL: "1h",
@@ -362,7 +382,7 @@ async function downloadRepo(repo, dest) {
362
382
  JWKS_ACTIVE_KID: "dev-main",
363
383
 
364
384
  RPID: "localhost",
365
- ORIGINS: `http://localhost:${apiPort}`,
385
+ ORIGINS: `http://localhost:${webPort}`,
366
386
  });
367
387
  }
368
388
 
@@ -375,9 +395,16 @@ async function downloadRepo(repo, dest) {
375
395
  writeEnv(dir, {
376
396
  AUTH_SERVER_URL: `http://localhost:${authPort}`,
377
397
  APP_ORIGIN: `http://localhost:${apiPort}`,
398
+ UI_ORIGIN: `http://localhost:${webPort}`,
378
399
  COOKIE_SIGNING_KEY: randomBytes(32).toString("hex"),
379
400
  API_SERVICE_TOKEN: API_SERVICE_TOKEN,
380
- DATABASE_URL: `postgres://myuser:mypassword@localhost:5432/seamless`,
401
+
402
+ DB_HOST: "localhost",
403
+ DB_PORT: "5432",
404
+ DB_NAME: "seamless_api",
405
+ DB_USER: "myuser",
406
+ DB_PASSWORD: "mypassword",
407
+
381
408
  DB_NAME: "seamless",
382
409
  SQL_LOGGING: "false",
383
410
  });
@@ -409,6 +436,16 @@ async function downloadRepo(repo, dest) {
409
436
  );
410
437
  }
411
438
 
439
+ const pgDir = path.join(root, "postgres_init");
440
+ fs.mkdirSync(pgDir);
441
+ fs.writeFileSync(
442
+ path.join(pgDir, "init.sql"),
443
+ `
444
+ CREATE DATABASE seamless_auth;
445
+ CREATE DATABASE seamless_api;
446
+ `,
447
+ );
448
+
412
449
  console.log(`
413
450
  ╔════════════════════════════════════════╗
414
451
  ║ S E A M L E S S ║
@@ -429,6 +466,10 @@ Start development:
429
466
  # terminal 3
430
467
  cd web && npm i && npm run dev
431
468
 
469
+ or if using Docker
470
+
471
+ docker compose up
472
+
432
473
  Docs: https://docs.seamlessauth.com/docs
433
474
  Happy hacking. 🚀
434
475
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-seamless",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "The starter script for Seamless Auth",
5
5
  "homepage": "https://github.com/fells-code/create-seamless#readme",
6
6
  "bugs": {