feat(web): llms.txt, convex live stats, switch to vercel and improved ui (#460)

This commit is contained in:
Aman Varshney
2025-08-03 02:42:15 +05:30
committed by GitHub
parent 004cc01a0c
commit fef7f6b5e2
38 changed files with 2352 additions and 2676 deletions

3
packages/backend/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.env.local
_generated

View File

@@ -0,0 +1,90 @@
# Welcome to your Convex functions directory!
Write your Convex functions here.
See https://docs.convex.dev/functions for more.
A query function that takes two arguments looks like:
```ts
// functions.js
import { query } from "./_generated/server";
import { v } from "convex/values";
export const myQueryFunction = query({
// Validators for arguments.
args: {
first: v.number(),
second: v.string(),
},
// Function implementation.
handler: async (ctx, args) => {
// Read the database as many times as you need here.
// See https://docs.convex.dev/database/reading-data.
const documents = await ctx.db.query("tablename").collect();
// Arguments passed from the client are properties of the args object.
console.log(args.first, args.second);
// Write arbitrary JavaScript here: filter, aggregate, build derived data,
// remove non-public properties, or create new objects.
return documents;
},
});
```
Using this query function in a React component looks like:
```ts
const data = useQuery(api.functions.myQueryFunction, {
first: 10,
second: "hello",
});
```
A mutation function looks like:
```ts
// functions.js
import { mutation } from "./_generated/server";
import { v } from "convex/values";
export const myMutationFunction = mutation({
// Validators for arguments.
args: {
first: v.string(),
second: v.string(),
},
// Function implementation.
handler: async (ctx, args) => {
// Insert or modify documents in the database here.
// Mutations can also read from the database like queries.
// See https://docs.convex.dev/database/writing-data.
const message = { body: args.first, author: args.second };
const id = await ctx.db.insert("messages", message);
// Optionally, return a value from your mutation.
return await ctx.db.get(id);
},
});
```
Using this mutation function in a React component looks like:
```ts
const mutation = useMutation(api.functions.myMutationFunction);
function handleButtonPress() {
// fire and forget, the most common way to use mutations
mutation({ first: "Hello!", second: "me" });
// OR
// use the result once the mutation has completed
mutation({ first: "Hello!", second: "me" }).then((result) =>
console.log(result),
);
}
```
Use the Convex CLI to push your functions to a deployment. See everything
the Convex CLI can do by running `npx convex -h` in your project root
directory. To learn more, launch the docs with `npx convex docs`.

View File

@@ -0,0 +1,7 @@
import ossStats from "@erquhart/convex-oss-stats/convex.config";
import { defineApp } from "convex/server";
const app = defineApp();
app.use(ossStats);
export default app;

View File

@@ -0,0 +1,7 @@
import { query } from "./_generated/server";
export const get = query({
handler: async () => {
return "OK";
},
});

View File

@@ -0,0 +1,7 @@
import { httpRouter } from "convex/server";
import { ossStats } from "./stats";
const http = httpRouter();
ossStats.registerRoutes(http);
export default http;

View File

@@ -0,0 +1,19 @@
import { OssStats } from "@erquhart/convex-oss-stats";
import { components } from "./_generated/api";
export const ossStats = new OssStats(components.ossStats, {
githubOwners: ["AmanVarshney01"],
githubRepos: ["AmanVarshney01/create-better-t-stack"],
npmPackages: ["create-better-t-stack"],
});
export const {
sync,
clearAndSync,
getGithubOwner,
getNpmOrg,
getGithubRepo,
getGithubRepos,
getNpmPackage,
getNpmPackages,
} = ossStats.api();

View File

@@ -0,0 +1,25 @@
{
/* This TypeScript project config describes the environment that
* Convex functions run in and is used to typecheck them.
* You can modify it, but some settings required to use Convex.
*/
"compilerOptions": {
/* These settings are not required by Convex and can be modified. */
"allowJs": true,
"strict": true,
"moduleResolution": "Bundler",
"jsx": "react-jsx",
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
/* These compiler options are required by Convex */
"target": "ESNext",
"lib": ["ES2021", "dom"],
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"isolatedModules": true,
"noEmit": true
},
"include": ["./**/*"],
"exclude": ["./_generated"]
}

View File

@@ -0,0 +1,18 @@
{
"name": "@better-t-stack/backend",
"version": "1.0.0",
"scripts": {
"dev": "convex dev",
"dev:setup": "convex dev --configure --until-success"
},
"author": "",
"license": "ISC",
"description": "",
"devDependencies": {
"typescript": "^5.9.2"
},
"dependencies": {
"@erquhart/convex-oss-stats": "^0.8.1",
"convex": "^1.25.4"
}
}