feat(db): mesh data model — meshes, members, invites, audit log

- pgSchema "mesh" with 4 tables isolating the peer mesh domain
- Enums: visibility, transport, tier, role
- audit_log is metadata-only (E2E encryption enforced at broker/client)
- Cascade on mesh delete, soft-delete via archivedAt/revokedAt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-04-04 21:19:32 +01:00
commit d3163a5bff
1384 changed files with 314925 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
/* eslint-disable turbo/no-undeclared-env-vars */
import { defineEnv } from "envin";
import * as z from "zod";
import { envConfig } from "@turbostarter/shared/constants";
import type { Preset } from "envin/types";
export const preset = {
id: "open-panel",
client: {
NEXT_PUBLIC_OPEN_PANEL_CLIENT_ID: z.string(),
},
server: {
OPEN_PANEL_SECRET: z.string(),
},
} as const satisfies Preset;
export const env = defineEnv({
...envConfig,
...preset,
env: {
...process.env,
NEXT_PUBLIC_OPEN_PANEL_CLIENT_ID:
process.env.NEXT_PUBLIC_OPEN_PANEL_CLIENT_ID,
},
});

View File

@@ -0,0 +1,45 @@
import { OpenPanelComponent } from "@openpanel/nextjs";
import { env } from "./env";
import type { AnalyticsProviderClientStrategy } from "@turbostarter/analytics";
export const { Provider, track, identify, reset } = {
Provider: ({ children }) => {
return (
<>
{children}
<OpenPanelComponent
clientId={env.NEXT_PUBLIC_OPEN_PANEL_CLIENT_ID}
trackScreenViews
trackAttributes
trackOutgoingLinks
/>
</>
);
},
track: (event, data) => {
if (typeof window === "undefined") {
return;
}
window.op("track", event, data);
},
identify: (userId, traits) => {
if (typeof window === "undefined") {
return;
}
window.op("identify", {
profileId: userId,
...traits,
});
},
reset: () => {
if (typeof window === "undefined") {
return;
}
window.op("clear");
},
} satisfies AnalyticsProviderClientStrategy;

View File

@@ -0,0 +1,28 @@
import { OpenPanel } from "@openpanel/nextjs";
import { env } from "./env";
import type { AnalyticsProviderServerStrategy } from "@turbostarter/analytics";
let client: OpenPanel | null = null;
const getClient = () => {
if (client) {
return client;
}
client = new OpenPanel({
clientId: env.NEXT_PUBLIC_OPEN_PANEL_CLIENT_ID,
clientSecret: env.OPEN_PANEL_SECRET,
});
return client;
};
export const { track } = {
track: (event, data) => {
const client = getClient();
void client.track(event, data);
},
} satisfies AnalyticsProviderServerStrategy;