feat: turbostarter boilerplate

Production-ready Next.js boilerplate with:
- Runtime env validation (fail-fast on missing vars)
- Feature-gated config (S3, Stripe, email, OAuth)
- Docker + Coolify deployment pipeline
- PostgreSQL + pgvector, MinIO S3, Better Auth
- TypeScript strict mode (no ignoreBuildErrors)
- i18n (en/es), AI modules, billing, monitoring

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-02-02 17:29:12 +00:00
commit 3527e732d4
1618 changed files with 338230 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
/* eslint-disable turbo/no-undeclared-env-vars */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
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: "posthog",
clientPrefix: "EXPO_PUBLIC_",
client: {
EXPO_PUBLIC_POSTHOG_KEY: z.string(),
EXPO_PUBLIC_POSTHOG_HOST: z
.string()
.optional()
.default("https://us.i.posthog.com"),
},
} as const satisfies Preset;
export const env = defineEnv({
...envConfig,
...preset,
env: {
EXPO_PUBLIC_POSTHOG_KEY: process.env.EXPO_PUBLIC_POSTHOG_KEY,
EXPO_PUBLIC_POSTHOG_HOST: process.env.EXPO_PUBLIC_POSTHOG_HOST,
},
});

View File

@@ -0,0 +1,73 @@
import PostHog, { PostHogProvider } from "posthog-react-native";
import { useEffect } from "react";
import { useTrackingPermissions } from "../../hooks";
import { env } from "./env";
import type { AnalyticsProviderClientStrategy } from "@turbostarter/analytics";
let client: PostHog | null = null;
const getClient = () => {
if (client) {
return client;
}
client = new PostHog(env.EXPO_PUBLIC_POSTHOG_KEY, {
host: env.EXPO_PUBLIC_POSTHOG_HOST,
defaultOptIn: false,
});
return client;
};
const Wrapper = ({ children }: { children: React.ReactNode }) => {
const client = getClient();
return (
<PostHogProvider client={client} autocapture>
{children}
</PostHogProvider>
);
};
const Setup = () => {
const client = getClient();
const granted = useTrackingPermissions();
useEffect(() => {
if (granted) {
void client.optIn();
} else {
void client.optOut();
}
}, [granted, client]);
return null;
};
const ProviderComponent = ({ children }: { children: React.ReactNode }) => {
return (
<Wrapper>
<Setup />
{children}
</Wrapper>
);
};
export const { Provider, track, identify, reset } = {
Provider: ProviderComponent,
track: (name, params) => {
const client = getClient();
client.capture(name, params);
},
identify: (userId, traits) => {
const client = getClient();
client.identify(userId, traits);
},
reset: () => {
const client = getClient();
client.reset();
},
} satisfies AnalyticsProviderClientStrategy;