Skip to content

Commit

Permalink
docs: create trpc app router example
Browse files Browse the repository at this point in the history
  • Loading branch information
c-ehrlich committed Jul 2, 2024
1 parent dc0966a commit 1c6aff8
Show file tree
Hide file tree
Showing 23 changed files with 6,915 additions and 2 deletions.
2 changes: 2 additions & 0 deletions examples/trpc-app-router/.env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_AXIOM_DATASET=""
NEXT_PUBLIC_AXIOM_TOKEN="xaat-"
36 changes: 36 additions & 0 deletions examples/trpc-app-router/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/** @type {import("eslint").Linter.Config} */
const config = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
plugins: ["@typescript-eslint"],
extends: [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
],
rules: {
// These opinionated rules are enabled in stylistic-type-checked above.
// Feel free to reconfigure them to your own preference.
"@typescript-eslint/array-type": "off",
"@typescript-eslint/consistent-type-definitions": "off",

"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-misused-promises": [
2,
{
checksVoidReturn: { attributes: false },
},
],
},
};

module.exports = config;
42 changes: 42 additions & 0 deletions examples/trpc-app-router/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# database
/prisma/db.sqlite
/prisma/db.sqlite-journal

# next.js
/.next/
/out/
next-env.d.ts

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables
.env
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
11 changes: 11 additions & 0 deletions examples/trpc-app-router/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# next-axiom tRPC + App Router Example

This is an example for using next-axiom with the Next.js App Router and tRPC. It is based on `create-t3-app`.

## Setup

- Clone this repo
- Add the dataset you want to ingest into and your token to `.env`
- Run `npm install`
- Run `npm run dev`
- Visit `localhost:3000`. Your app should now be logging to Axiom.
12 changes: 12 additions & 0 deletions examples/trpc-app-router/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { withAxiomNextConfig } from "next-axiom";

/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
* for Docker builds.
*/
await import("./src/env.mjs");

/** @type {import("next").NextConfig} */
const config = {};

export default withAxiomNextConfig(config);
Loading

0 comments on commit 1c6aff8

Please sign in to comment.