openship 0.1.0 → 0.1.7
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/dist/index.d.ts +1 -0
- package/dist/index.js +5786 -0
- package/dist/server/index.js +324319 -0
- package/dist/server/migrations/0000_init.sql +666 -0
- package/dist/server/migrations/0001_brief_tomorrow_man.sql +47 -0
- package/dist/server/migrations/0002_funny_dazzler.sql +2 -0
- package/dist/server/migrations/0003_third_killer_shrike.sql +1 -0
- package/dist/server/migrations/0004_session_active_org_not_null.sql +10 -0
- package/dist/server/migrations/0005_warm_amazoness.sql +3 -0
- package/dist/server/migrations/0006_lumpy_joystick.sql +1 -0
- package/dist/server/migrations/0007_outgoing_maginty.sql +2 -0
- package/dist/server/migrations/0008_frozen_cutover.sql +3 -0
- package/dist/server/migrations/0009_credits_billing.sql +142 -0
- package/dist/server/migrations/0010_credit_grant_dedupe.sql +14 -0
- package/dist/server/migrations/0011_remove_credit_ledger.sql +23 -0
- package/dist/server/migrations/0012_smart_deploys_and_git_rollback.sql +81 -0
- package/dist/server/migrations/0013_fix_check_run_rollup_unique.sql +38 -0
- package/dist/server/migrations/0014_default_rollback_git.sql +9 -0
- package/dist/server/migrations/0015_billing_idempotency_grants.sql +41 -0
- package/dist/server/migrations/0016_github_auth_high_findings.sql +30 -0
- package/dist/server/migrations/0017_spooky_rumiko_fujikawa.sql +6 -0
- package/dist/server/migrations/0018_calm_shatterstar.sql +1 -0
- package/dist/server/migrations/0019_rename_workspace_install_to_prepare.sql +1 -0
- package/dist/server/migrations/0020_uneven_the_renegades.sql +13 -0
- package/dist/server/migrations/0021_shiny_firestar.sql +2 -0
- package/dist/server/migrations/0022_version_on_success_backfill.sql +6 -0
- package/dist/server/migrations/0023_productive_gorilla_man.sql +17 -0
- package/dist/server/migrations/0024_sleepy_peter_quill.sql +2 -0
- package/dist/server/migrations/0025_smooth_blue_shield.sql +1 -0
- package/dist/server/migrations/0026_mail_backup_source.sql +11 -0
- package/dist/server/migrations/0027_opposite_anthem.sql +6 -0
- package/dist/server/migrations/0028_stale_rogue.sql +18 -0
- package/dist/server/migrations/0029_bouncy_loners.sql +16 -0
- package/dist/server/migrations/0030_bright_darkstar.sql +6 -0
- package/dist/server/migrations/0031_conscious_catseye.sql +13 -0
- package/dist/server/migrations/0032_wet_mimic.sql +51 -0
- package/dist/server/migrations/0033_eminent_molly_hayes.sql +2 -0
- package/dist/server/migrations/meta/0000_snapshot.json +5110 -0
- package/dist/server/migrations/meta/0001_snapshot.json +5257 -0
- package/dist/server/migrations/meta/0002_snapshot.json +5279 -0
- package/dist/server/migrations/meta/0003_snapshot.json +5286 -0
- package/dist/server/migrations/meta/0004_snapshot.json +5286 -0
- package/dist/server/migrations/meta/0005_snapshot.json +5305 -0
- package/dist/server/migrations/meta/0006_snapshot.json +5311 -0
- package/dist/server/migrations/meta/0007_snapshot.json +5323 -0
- package/dist/server/migrations/meta/0016_snapshot.json +6345 -0
- package/dist/server/migrations/meta/0017_snapshot.json +6383 -0
- package/dist/server/migrations/meta/0018_snapshot.json +6390 -0
- package/dist/server/migrations/meta/0019_snapshot.json +6390 -0
- package/dist/server/migrations/meta/0020_snapshot.json +6497 -0
- package/dist/server/migrations/meta/0021_snapshot.json +6509 -0
- package/dist/server/migrations/meta/0022_snapshot.json +6509 -0
- package/dist/server/migrations/meta/0023_snapshot.json +6629 -0
- package/dist/server/migrations/meta/0024_snapshot.json +6641 -0
- package/dist/server/migrations/meta/0025_snapshot.json +6648 -0
- package/dist/server/migrations/meta/0026_snapshot.json +6750 -0
- package/dist/server/migrations/meta/0027_snapshot.json +6757 -0
- package/dist/server/migrations/meta/0028_snapshot.json +6895 -0
- package/dist/server/migrations/meta/0029_snapshot.json +7028 -0
- package/dist/server/migrations/meta/0030_snapshot.json +7066 -0
- package/dist/server/migrations/meta/0031_snapshot.json +7181 -0
- package/dist/server/migrations/meta/0032_snapshot.json +7570 -0
- package/dist/server/migrations/meta/0033_snapshot.json +7597 -0
- package/dist/server/migrations/meta/_journal.json +244 -0
- package/dist/server/pglite/pglite.data +0 -0
- package/dist/server/pglite/pglite.wasm +0 -0
- package/package.json +33 -21
- package/.env.example +0 -22
- package/.nvmrc +0 -1
- package/.prettierrc +0 -7
- package/CONTRIBUTING.md +0 -40
- package/README.md +0 -164
- package/apps/api/.env.example +0 -30
- package/apps/api/Dockerfile +0 -24
- package/apps/api/package.json +0 -37
- package/apps/api/src/app.ts +0 -26
- package/apps/api/src/config/env.ts +0 -39
- package/apps/api/src/config/index.ts +0 -1
- package/apps/api/src/index.ts +0 -8
- package/apps/api/src/middleware/auth.ts +0 -24
- package/apps/api/src/middleware/error-handler.ts +0 -21
- package/apps/api/src/middleware/index.ts +0 -3
- package/apps/api/src/middleware/rate-limiter.ts +0 -26
- package/apps/api/src/modules/auth/auth.controller.ts +0 -26
- package/apps/api/src/modules/auth/auth.routes.ts +0 -10
- package/apps/api/src/modules/auth/auth.schema.ts +0 -12
- package/apps/api/src/modules/auth/auth.service.ts +0 -23
- package/apps/api/src/modules/billing/billing.controller.ts +0 -60
- package/apps/api/src/modules/billing/billing.routes.ts +0 -26
- package/apps/api/src/modules/billing/billing.schema.ts +0 -9
- package/apps/api/src/modules/billing/billing.service.ts +0 -33
- package/apps/api/src/modules/deployments/deployment.controller.ts +0 -35
- package/apps/api/src/modules/deployments/deployment.routes.ts +0 -11
- package/apps/api/src/modules/deployments/deployment.schema.ts +0 -7
- package/apps/api/src/modules/deployments/deployment.service.ts +0 -23
- package/apps/api/src/modules/domains/domain.controller.ts +0 -21
- package/apps/api/src/modules/domains/domain.routes.ts +0 -9
- package/apps/api/src/modules/domains/domain.service.ts +0 -19
- package/apps/api/src/modules/health/health.routes.ts +0 -10
- package/apps/api/src/modules/projects/project.controller.ts +0 -29
- package/apps/api/src/modules/projects/project.routes.ts +0 -10
- package/apps/api/src/modules/projects/project.schema.ts +0 -9
- package/apps/api/src/modules/projects/project.service.ts +0 -23
- package/apps/api/src/modules/webhooks/webhook.controller.ts +0 -22
- package/apps/api/src/modules/webhooks/webhook.routes.ts +0 -12
- package/apps/api/src/modules/webhooks/webhook.service.ts +0 -11
- package/apps/api/tsconfig.json +0 -12
- package/apps/cli/package.json +0 -28
- package/apps/cli/src/commands/deploy.ts +0 -11
- package/apps/cli/src/commands/init.ts +0 -8
- package/apps/cli/src/commands/login.ts +0 -8
- package/apps/cli/src/commands/logs.ts +0 -9
- package/apps/cli/src/index.ts +0 -21
- package/apps/cli/src/lib/api-client.ts +0 -35
- package/apps/cli/tsconfig.json +0 -12
- package/apps/dashboard/Dockerfile +0 -24
- package/apps/dashboard/next.config.mjs +0 -6
- package/apps/dashboard/package.json +0 -28
- package/apps/dashboard/src/app/(auth)/layout.tsx +0 -6
- package/apps/dashboard/src/app/(auth)/login/page.tsx +0 -11
- package/apps/dashboard/src/app/(auth)/register/page.tsx +0 -10
- package/apps/dashboard/src/app/(dashboard)/billing/page.tsx +0 -10
- package/apps/dashboard/src/app/(dashboard)/deployments/page.tsx +0 -8
- package/apps/dashboard/src/app/(dashboard)/domains/page.tsx +0 -8
- package/apps/dashboard/src/app/(dashboard)/layout.tsx +0 -37
- package/apps/dashboard/src/app/(dashboard)/monitoring/page.tsx +0 -8
- package/apps/dashboard/src/app/(dashboard)/projects/page.tsx +0 -8
- package/apps/dashboard/src/app/(dashboard)/settings/page.tsx +0 -8
- package/apps/dashboard/src/app/globals.css +0 -3
- package/apps/dashboard/src/app/layout.tsx +0 -15
- package/apps/dashboard/src/app/page.tsx +0 -6
- package/apps/dashboard/tsconfig.json +0 -11
- package/apps/web/Dockerfile +0 -24
- package/apps/web/next.config.mjs +0 -6
- package/apps/web/package.json +0 -26
- package/apps/web/src/app/(marketing)/docs/page.tsx +0 -10
- package/apps/web/src/app/(marketing)/layout.tsx +0 -24
- package/apps/web/src/app/(marketing)/page.tsx +0 -2
- package/apps/web/src/app/(marketing)/pricing/page.tsx +0 -10
- package/apps/web/src/app/globals.css +0 -3
- package/apps/web/src/app/layout.tsx +0 -16
- package/apps/web/src/app/page.tsx +0 -10
- package/apps/web/tsconfig.json +0 -11
- package/docker-compose.yml +0 -87
- package/packages/adapters/package.json +0 -27
- package/packages/adapters/src/base-adapter.ts +0 -49
- package/packages/adapters/src/docker-adapter.ts +0 -43
- package/packages/adapters/src/index.ts +0 -4
- package/packages/adapters/src/oblien-adapter.ts +0 -46
- package/packages/adapters/src/registry.ts +0 -22
- package/packages/adapters/tsconfig.json +0 -9
- package/packages/core/package.json +0 -27
- package/packages/core/src/constants.ts +0 -28
- package/packages/core/src/errors.ts +0 -49
- package/packages/core/src/index.ts +0 -4
- package/packages/core/src/types.ts +0 -47
- package/packages/core/src/utils.ts +0 -35
- package/packages/core/tsconfig.json +0 -9
- package/packages/db/package.json +0 -32
- package/packages/db/prisma/schema.prisma +0 -160
- package/packages/db/src/index.ts +0 -11
- package/packages/db/tsconfig.json +0 -9
- package/packages/ui/package.json +0 -38
- package/packages/ui/src/components/badge.tsx +0 -29
- package/packages/ui/src/components/button.tsx +0 -44
- package/packages/ui/src/components/card.tsx +0 -26
- package/packages/ui/src/components/status-dot.tsx +0 -25
- package/packages/ui/src/globals.css +0 -18
- package/packages/ui/src/index.tsx +0 -8
- package/packages/ui/src/lib/cn.ts +0 -7
- package/packages/ui/tsconfig.json +0 -9
- package/pnpm-workspace.yaml +0 -4
- package/tooling/tsconfig/base.json +0 -19
- package/tooling/tsconfig/nextjs.json +0 -10
- package/tooling/tsconfig/node.json +0 -10
- package/tooling/tsconfig/package.json +0 -7
- package/turbo.json +0 -32
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* API configuration — loaded from environment variables.
|
|
5
|
-
*
|
|
6
|
-
* CLOUD_MODE=true enables billing, metering, and multi-tenant features.
|
|
7
|
-
* CLOUD_MODE=false (default) runs as a self-hosted single-tenant instance.
|
|
8
|
-
*/
|
|
9
|
-
const envSchema = z.object({
|
|
10
|
-
NODE_ENV: z.enum(["development", "production", "test"]).default("development"),
|
|
11
|
-
PORT: z.coerce.number().default(4000),
|
|
12
|
-
|
|
13
|
-
/* ---------- Mode ---------- */
|
|
14
|
-
CLOUD_MODE: z.coerce.boolean().default(false),
|
|
15
|
-
|
|
16
|
-
/* ---------- Database ---------- */
|
|
17
|
-
DATABASE_URL: z.string().default("file:./dev.db"),
|
|
18
|
-
|
|
19
|
-
/* ---------- Auth ---------- */
|
|
20
|
-
JWT_SECRET: z.string().default("change-me-in-production"),
|
|
21
|
-
JWT_EXPIRES_IN: z.string().default("15m"),
|
|
22
|
-
JWT_REFRESH_EXPIRES_IN: z.string().default("7d"),
|
|
23
|
-
|
|
24
|
-
/* ---------- Redis ---------- */
|
|
25
|
-
REDIS_URL: z.string().default("redis://localhost:6379"),
|
|
26
|
-
|
|
27
|
-
/* ---------- Stripe (Cloud only) ---------- */
|
|
28
|
-
STRIPE_SECRET_KEY: z.string().optional(),
|
|
29
|
-
STRIPE_WEBHOOK_SECRET: z.string().optional(),
|
|
30
|
-
|
|
31
|
-
/* ---------- Git Providers ---------- */
|
|
32
|
-
GITHUB_APP_ID: z.string().optional(),
|
|
33
|
-
GITHUB_PRIVATE_KEY: z.string().optional(),
|
|
34
|
-
GITHUB_WEBHOOK_SECRET: z.string().optional(),
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export type Env = z.infer<typeof envSchema>;
|
|
38
|
-
|
|
39
|
-
export const env = envSchema.parse(process.env);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { env } from "./env";
|
package/apps/api/src/index.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Context, Next } from "hono";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* JWT authentication middleware.
|
|
5
|
-
* Extracts and verifies the Bearer token from the Authorization header.
|
|
6
|
-
*/
|
|
7
|
-
export async function authMiddleware(c: Context, next: Next) {
|
|
8
|
-
const header = c.req.header("Authorization");
|
|
9
|
-
|
|
10
|
-
if (!header?.startsWith("Bearer ")) {
|
|
11
|
-
return c.json({ error: "Unauthorized" }, 401);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const token = header.slice(7);
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
// TODO: Verify JWT, attach user to context
|
|
18
|
-
// const payload = verifyToken(token);
|
|
19
|
-
// c.set("user", payload);
|
|
20
|
-
await next();
|
|
21
|
-
} catch {
|
|
22
|
-
return c.json({ error: "Invalid token" }, 401);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Context, Next } from "hono";
|
|
2
|
-
import { ZodError } from "zod";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Global error handler middleware.
|
|
6
|
-
*/
|
|
7
|
-
export async function errorHandler(c: Context, next: Next) {
|
|
8
|
-
try {
|
|
9
|
-
await next();
|
|
10
|
-
} catch (err) {
|
|
11
|
-
if (err instanceof ZodError) {
|
|
12
|
-
return c.json(
|
|
13
|
-
{ error: "Validation error", details: err.flatten().fieldErrors },
|
|
14
|
-
400,
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
console.error("[ERROR]", err);
|
|
19
|
-
return c.json({ error: "Internal server error" }, 500);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Context, Next } from "hono";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Rate-limiting middleware.
|
|
5
|
-
* Uses a simple in-memory store (swap for Redis in production).
|
|
6
|
-
*/
|
|
7
|
-
const requestCounts = new Map<string, { count: number; resetAt: number }>();
|
|
8
|
-
|
|
9
|
-
export async function rateLimiter(c: Context, next: Next) {
|
|
10
|
-
const ip = c.req.header("x-forwarded-for") || "unknown";
|
|
11
|
-
const now = Date.now();
|
|
12
|
-
const window = 60_000; // 1 minute
|
|
13
|
-
const maxRequests = 100;
|
|
14
|
-
|
|
15
|
-
const entry = requestCounts.get(ip);
|
|
16
|
-
|
|
17
|
-
if (!entry || now > entry.resetAt) {
|
|
18
|
-
requestCounts.set(ip, { count: 1, resetAt: now + window });
|
|
19
|
-
} else if (entry.count >= maxRequests) {
|
|
20
|
-
return c.json({ error: "Too many requests" }, 429);
|
|
21
|
-
} else {
|
|
22
|
-
entry.count++;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
await next();
|
|
26
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Context } from "hono";
|
|
2
|
-
|
|
3
|
-
export async function register(c: Context) {
|
|
4
|
-
// TODO: Implement registration with auth.service
|
|
5
|
-
return c.json({ message: "register" }, 201);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export async function login(c: Context) {
|
|
9
|
-
// TODO: Implement login
|
|
10
|
-
return c.json({ message: "login" });
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function logout(c: Context) {
|
|
14
|
-
// TODO: Implement logout
|
|
15
|
-
return c.json({ message: "logout" });
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export async function refresh(c: Context) {
|
|
19
|
-
// TODO: Implement token refresh
|
|
20
|
-
return c.json({ message: "refresh" });
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function me(c: Context) {
|
|
24
|
-
// TODO: Return current user from JWT
|
|
25
|
-
return c.json({ message: "me" });
|
|
26
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import * as authController from "./auth.controller";
|
|
3
|
-
|
|
4
|
-
export const authRoutes = new Hono();
|
|
5
|
-
|
|
6
|
-
authRoutes.post("/register", authController.register);
|
|
7
|
-
authRoutes.post("/login", authController.login);
|
|
8
|
-
authRoutes.post("/logout", authController.logout);
|
|
9
|
-
authRoutes.post("/refresh", authController.refresh);
|
|
10
|
-
authRoutes.get("/me", authController.me);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export const registerSchema = z.object({
|
|
4
|
-
email: z.string().email(),
|
|
5
|
-
password: z.string().min(8),
|
|
6
|
-
name: z.string().optional(),
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export const loginSchema = z.object({
|
|
10
|
-
email: z.string().email(),
|
|
11
|
-
password: z.string(),
|
|
12
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth service — handles password hashing, JWT signing, user creation.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export async function createUser(data: {
|
|
6
|
-
email: string;
|
|
7
|
-
password: string;
|
|
8
|
-
name?: string;
|
|
9
|
-
}) {
|
|
10
|
-
// TODO: Hash password, insert into DB, return user
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function verifyCredentials(email: string, password: string) {
|
|
14
|
-
// TODO: Fetch user, compare password hash
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function generateTokens(userId: string) {
|
|
18
|
-
// TODO: Sign access + refresh JWTs
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function refreshAccessToken(refreshToken: string) {
|
|
22
|
-
// TODO: Verify refresh token, return new access token
|
|
23
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { Context } from "hono";
|
|
2
|
-
|
|
3
|
-
/* ---------- Plans ---------- */
|
|
4
|
-
export async function listPlans(c: Context) {
|
|
5
|
-
// TODO: Return available pricing plans (free, pro, team, enterprise)
|
|
6
|
-
return c.json({
|
|
7
|
-
data: [
|
|
8
|
-
{ id: "free", name: "Free", price: 0, features: ["Self-hosted", "Community support"] },
|
|
9
|
-
{ id: "pro", name: "Pro", price: 20, features: ["Cloud hosting", "Custom domains", "Priority support"] },
|
|
10
|
-
{ id: "team", name: "Team", price: 50, features: ["All Pro features", "Team management", "SSO"] },
|
|
11
|
-
],
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/* ---------- Subscriptions ---------- */
|
|
16
|
-
export async function getSubscription(c: Context) {
|
|
17
|
-
return c.json({ data: null });
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export async function createSubscription(c: Context) {
|
|
21
|
-
// TODO: Create Stripe checkout session
|
|
22
|
-
return c.json({ message: "subscription created" }, 201);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export async function updateSubscription(c: Context) {
|
|
26
|
-
// TODO: Upgrade/downgrade plan
|
|
27
|
-
return c.json({ message: "subscription updated" });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export async function cancelSubscription(c: Context) {
|
|
31
|
-
// TODO: Cancel at period end
|
|
32
|
-
return c.json({ message: "subscription cancelled" });
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/* ---------- Usage ---------- */
|
|
36
|
-
export async function getUsage(c: Context) {
|
|
37
|
-
// TODO: Return current billing period usage (build minutes, bandwidth, etc.)
|
|
38
|
-
return c.json({ data: { buildMinutes: 0, bandwidth: 0 } });
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/* ---------- Payment Methods ---------- */
|
|
42
|
-
export async function listPaymentMethods(c: Context) {
|
|
43
|
-
return c.json({ data: [] });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export async function addPaymentMethod(c: Context) {
|
|
47
|
-
// TODO: Create Stripe setup intent
|
|
48
|
-
return c.json({ message: "payment method added" }, 201);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* ---------- Invoices ---------- */
|
|
52
|
-
export async function listInvoices(c: Context) {
|
|
53
|
-
return c.json({ data: [] });
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/* ---------- Stripe Webhook ---------- */
|
|
57
|
-
export async function stripeWebhook(c: Context) {
|
|
58
|
-
// TODO: Verify Stripe signature, handle events
|
|
59
|
-
return c.json({ received: true });
|
|
60
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import * as billingController from "./billing.controller";
|
|
3
|
-
|
|
4
|
-
export const billingRoutes = new Hono();
|
|
5
|
-
|
|
6
|
-
/* ---------- Plans & Pricing ---------- */
|
|
7
|
-
billingRoutes.get("/plans", billingController.listPlans);
|
|
8
|
-
|
|
9
|
-
/* ---------- Subscriptions ---------- */
|
|
10
|
-
billingRoutes.get("/subscription", billingController.getSubscription);
|
|
11
|
-
billingRoutes.post("/subscription", billingController.createSubscription);
|
|
12
|
-
billingRoutes.patch("/subscription", billingController.updateSubscription);
|
|
13
|
-
billingRoutes.delete("/subscription", billingController.cancelSubscription);
|
|
14
|
-
|
|
15
|
-
/* ---------- Usage ---------- */
|
|
16
|
-
billingRoutes.get("/usage", billingController.getUsage);
|
|
17
|
-
|
|
18
|
-
/* ---------- Payment Methods ---------- */
|
|
19
|
-
billingRoutes.get("/payment-methods", billingController.listPaymentMethods);
|
|
20
|
-
billingRoutes.post("/payment-methods", billingController.addPaymentMethod);
|
|
21
|
-
|
|
22
|
-
/* ---------- Invoices ---------- */
|
|
23
|
-
billingRoutes.get("/invoices", billingController.listInvoices);
|
|
24
|
-
|
|
25
|
-
/* ---------- Stripe Webhook (no auth) ---------- */
|
|
26
|
-
billingRoutes.post("/webhook/stripe", billingController.stripeWebhook);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Billing service — Stripe integration for cloud pricing.
|
|
3
|
-
*
|
|
4
|
-
* Self-hosted instances skip billing entirely (gated by CLOUD_MODE env var).
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export async function createCheckoutSession(userId: string, planId: string) {
|
|
8
|
-
// TODO: Create Stripe Checkout session
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export async function createCustomer(userId: string, email: string) {
|
|
12
|
-
// TODO: Create Stripe customer
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export async function getSubscription(userId: string) {
|
|
16
|
-
// TODO: Fetch active subscription from DB
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function cancelSubscription(subscriptionId: string) {
|
|
20
|
-
// TODO: Cancel Stripe subscription at period end
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function recordUsage(userId: string, metric: string, quantity: number) {
|
|
24
|
-
// TODO: Record metered usage for billing
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export async function getUsageSummary(userId: string) {
|
|
28
|
-
// TODO: Aggregate usage for current billing period
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export async function handleStripeEvent(event: unknown) {
|
|
32
|
-
// TODO: Handle subscription.created, invoice.paid, etc.
|
|
33
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Context } from "hono";
|
|
2
|
-
|
|
3
|
-
export async function list(c: Context) {
|
|
4
|
-
// TODO: List deployments (optionally filtered by projectId)
|
|
5
|
-
return c.json({ data: [] });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export async function create(c: Context) {
|
|
9
|
-
// TODO: Trigger new deployment via adapter
|
|
10
|
-
return c.json({ message: "deployment queued" }, 202);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function getById(c: Context) {
|
|
14
|
-
const id = c.req.param("id");
|
|
15
|
-
// TODO: Get deployment details + status
|
|
16
|
-
return c.json({ data: { id } });
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function logs(c: Context) {
|
|
20
|
-
const id = c.req.param("id");
|
|
21
|
-
// TODO: Stream or return deployment logs
|
|
22
|
-
return c.json({ data: { id, logs: [] } });
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export async function rollback(c: Context) {
|
|
26
|
-
const id = c.req.param("id");
|
|
27
|
-
// TODO: Rollback to this deployment
|
|
28
|
-
return c.json({ message: "rollback initiated" });
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export async function cancel(c: Context) {
|
|
32
|
-
const id = c.req.param("id");
|
|
33
|
-
// TODO: Cancel in-progress deployment
|
|
34
|
-
return c.json({ message: "deployment cancelled" });
|
|
35
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import * as deploymentController from "./deployment.controller";
|
|
3
|
-
|
|
4
|
-
export const deploymentRoutes = new Hono();
|
|
5
|
-
|
|
6
|
-
deploymentRoutes.get("/", deploymentController.list);
|
|
7
|
-
deploymentRoutes.post("/", deploymentController.create);
|
|
8
|
-
deploymentRoutes.get("/:id", deploymentController.getById);
|
|
9
|
-
deploymentRoutes.get("/:id/logs", deploymentController.logs);
|
|
10
|
-
deploymentRoutes.post("/:id/rollback", deploymentController.rollback);
|
|
11
|
-
deploymentRoutes.post("/:id/cancel", deploymentController.cancel);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deployment service — orchestrates builds and deployments via adapters.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export async function queueDeployment(projectId: string, opts: { branch?: string }) {
|
|
6
|
-
// TODO: Create deployment record, push to BullMQ queue
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export async function processDeployment(deploymentId: string) {
|
|
10
|
-
// TODO: Pull adapter (Docker / Oblien), build, deploy
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function getDeploymentLogs(deploymentId: string) {
|
|
14
|
-
// TODO: Fetch logs from adapter or storage
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function rollbackDeployment(deploymentId: string) {
|
|
18
|
-
// TODO: Re-activate a previous deployment
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function cancelDeployment(deploymentId: string) {
|
|
22
|
-
// TODO: Signal adapter to stop build
|
|
23
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Context } from "hono";
|
|
2
|
-
|
|
3
|
-
export async function list(c: Context) {
|
|
4
|
-
return c.json({ data: [] });
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export async function add(c: Context) {
|
|
8
|
-
// TODO: Add custom domain, generate DNS verification record
|
|
9
|
-
return c.json({ message: "domain added" }, 201);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export async function remove(c: Context) {
|
|
13
|
-
const id = c.req.param("id");
|
|
14
|
-
return c.json({ message: "domain removed" });
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function verify(c: Context) {
|
|
18
|
-
const id = c.req.param("id");
|
|
19
|
-
// TODO: Check DNS records to verify ownership
|
|
20
|
-
return c.json({ message: "verification started" });
|
|
21
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import * as domainController from "./domain.controller";
|
|
3
|
-
|
|
4
|
-
export const domainRoutes = new Hono();
|
|
5
|
-
|
|
6
|
-
domainRoutes.get("/", domainController.list);
|
|
7
|
-
domainRoutes.post("/", domainController.add);
|
|
8
|
-
domainRoutes.delete("/:id", domainController.remove);
|
|
9
|
-
domainRoutes.post("/:id/verify", domainController.verify);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain service — manage custom domains and SSL certificates.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export async function addDomain(projectId: string, domain: string) {
|
|
6
|
-
// TODO: Store domain, create TXT verification record
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export async function verifyDomain(domainId: string) {
|
|
10
|
-
// TODO: DNS lookup to check verification
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function removeDomain(domainId: string) {
|
|
14
|
-
// TODO: Remove domain and revoke certificate
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function provisionSSL(domain: string) {
|
|
18
|
-
// TODO: Issue Let's Encrypt certificate
|
|
19
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Health check module — used by load balancers and Docker health checks.
|
|
3
|
-
*/
|
|
4
|
-
import { Hono } from "hono";
|
|
5
|
-
|
|
6
|
-
export const healthRoutes = new Hono();
|
|
7
|
-
|
|
8
|
-
healthRoutes.get("/", (c) => {
|
|
9
|
-
return c.json({ status: "ok", timestamp: new Date().toISOString() });
|
|
10
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Context } from "hono";
|
|
2
|
-
|
|
3
|
-
export async function list(c: Context) {
|
|
4
|
-
// TODO: List all projects for authenticated user
|
|
5
|
-
return c.json({ data: [] });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export async function create(c: Context) {
|
|
9
|
-
// TODO: Create new project
|
|
10
|
-
return c.json({ message: "created" }, 201);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function getById(c: Context) {
|
|
14
|
-
const id = c.req.param("id");
|
|
15
|
-
// TODO: Fetch project by ID
|
|
16
|
-
return c.json({ data: { id } });
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function update(c: Context) {
|
|
20
|
-
const id = c.req.param("id");
|
|
21
|
-
// TODO: Update project
|
|
22
|
-
return c.json({ data: { id } });
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export async function remove(c: Context) {
|
|
26
|
-
const id = c.req.param("id");
|
|
27
|
-
// TODO: Soft-delete project
|
|
28
|
-
return c.json({ message: "deleted" });
|
|
29
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import * as projectController from "./project.controller";
|
|
3
|
-
|
|
4
|
-
export const projectRoutes = new Hono();
|
|
5
|
-
|
|
6
|
-
projectRoutes.get("/", projectController.list);
|
|
7
|
-
projectRoutes.post("/", projectController.create);
|
|
8
|
-
projectRoutes.get("/:id", projectController.getById);
|
|
9
|
-
projectRoutes.patch("/:id", projectController.update);
|
|
10
|
-
projectRoutes.delete("/:id", projectController.remove);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export const createProjectSchema = z.object({
|
|
4
|
-
name: z.string().min(1).max(100),
|
|
5
|
-
repo: z.string().url().optional(),
|
|
6
|
-
framework: z.enum(["nextjs", "node", "static", "docker"]).optional(),
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export const updateProjectSchema = createProjectSchema.partial();
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project service — CRUD operations for user projects.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export async function listProjects(userId: string) {
|
|
6
|
-
// TODO: Query DB for user's projects
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export async function createProject(userId: string, data: { name: string; repo?: string }) {
|
|
10
|
-
// TODO: Insert project, set up initial config
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function getProject(projectId: string) {
|
|
14
|
-
// TODO: Fetch single project
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function updateProject(projectId: string, data: Partial<{ name: string }>) {
|
|
18
|
-
// TODO: Update project fields
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function deleteProject(projectId: string) {
|
|
22
|
-
// TODO: Soft-delete project and associated deployments
|
|
23
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Context } from "hono";
|
|
2
|
-
|
|
3
|
-
export async function github(c: Context) {
|
|
4
|
-
// TODO: Verify GitHub signature, parse push event, trigger deployment
|
|
5
|
-
return c.json({ received: true });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export async function gitlab(c: Context) {
|
|
9
|
-
// TODO: Verify GitLab token, parse push event
|
|
10
|
-
return c.json({ received: true });
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function bitbucket(c: Context) {
|
|
14
|
-
// TODO: Verify Bitbucket signature
|
|
15
|
-
return c.json({ received: true });
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export async function custom(c: Context) {
|
|
19
|
-
const projectId = c.req.param("projectId");
|
|
20
|
-
// TODO: Trigger deployment for project from custom webhook
|
|
21
|
-
return c.json({ received: true, projectId });
|
|
22
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import * as webhookController from "./webhook.controller";
|
|
3
|
-
|
|
4
|
-
export const webhookRoutes = new Hono();
|
|
5
|
-
|
|
6
|
-
/* Git provider webhooks (push events trigger deployments) */
|
|
7
|
-
webhookRoutes.post("/github", webhookController.github);
|
|
8
|
-
webhookRoutes.post("/gitlab", webhookController.gitlab);
|
|
9
|
-
webhookRoutes.post("/bitbucket", webhookController.bitbucket);
|
|
10
|
-
|
|
11
|
-
/* Generic webhook for custom integrations */
|
|
12
|
-
webhookRoutes.post("/custom/:projectId", webhookController.custom);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Webhook service — verifies signatures and dispatches events.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export async function verifyGitHubSignature(payload: string, signature: string, secret: string) {
|
|
6
|
-
// TODO: HMAC-SHA256 verification
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export async function handlePushEvent(projectId: string, branch: string, commitSha: string) {
|
|
10
|
-
// TODO: Queue new deployment
|
|
11
|
-
}
|
package/apps/api/tsconfig.json
DELETED
package/apps/cli/package.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "openship-cli",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"bin": {
|
|
6
|
-
"openship": "./dist/index.js"
|
|
7
|
-
},
|
|
8
|
-
"scripts": {
|
|
9
|
-
"dev": "tsx src/index.ts",
|
|
10
|
-
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
11
|
-
"lint": "tsc --noEmit",
|
|
12
|
-
"clean": "rm -rf dist .turbo node_modules"
|
|
13
|
-
},
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"openship-core": "workspace:*",
|
|
16
|
-
"commander": "^12.1.0",
|
|
17
|
-
"chalk": "^5.3.0",
|
|
18
|
-
"ora": "^8.0.0",
|
|
19
|
-
"prompts": "^2.4.0"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"openship-tsconfig": "workspace:*",
|
|
23
|
-
"@types/prompts": "^2.4.0",
|
|
24
|
-
"tsx": "^4.11.0",
|
|
25
|
-
"tsup": "^8.1.0",
|
|
26
|
-
"typescript": "^5.4.0"
|
|
27
|
-
}
|
|
28
|
-
}
|