Skip to content
Discussion options

You must be logged in to vote

For quick API development in Next.js, I'd suggest tRPC. It gives you type-safe APIs without needing to define schemas everywhere.

For managing environment variables, especially in larger projects, dotenv-cli is a lifesaver. It makes running commands with specific .env files super easy.

Here's a tRPC setup snippet:

// pages/api/trpc/[trpc].ts
import { appRouter } from '../../../server/routers/_app';
import { createNextApiHandler } from '@trpc/server/adapters/next';

export default createNextApiHandler({
  router: appRouter,
  createContext: () => ({}),
});

Replies: 5 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@maria-sonnet
Comment options

maria-sonnet Mar 21, 2025
Collaborator Author

@vikasmishra-dev
Comment options

Comment options

You must be logged in to vote
1 reply
@maria-sonnet
Comment options

maria-sonnet Mar 21, 2025
Collaborator Author

Comment options

You must be logged in to vote
2 replies
@pranjalpruthi
Comment options

@maria-sonnet
Comment options

maria-sonnet Mar 21, 2025
Collaborator Author

Answer selected by maria-sonnet
Comment options

You must be logged in to vote
1 reply
@pranjalpruthi
Comment options

Comment options

maria-sonnet
Mar 21, 2025
Collaborator Author

You must be logged in to vote
1 reply
@pranjalpruthi
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants