Nextjs FAQ

When to Use Direct API Calls vs. Next.js Server Proxy Use Next.js API Routes when: You need to hide API keys or other secrets You want to aggregate multiple API calls You need to transform data before sending it to the client Your API requires complex authentication that’s better handled server-side Direct API calls might be acceptable when: The API is public and requires no sensitive credentials You’re working with a simple prototype The backend already handles CORS and is specifically designed for browser access You need real-time updates (although you could still use WebSockets through Next....

March 4, 2025

Building a Website With Laravel and Nextjs Part 2 : Nextjs

Built a Next.js application that integrates with a Laravel API, implementing user authentication and data fetching functionality. Before start Before starting, you need to understand the basic concepts of React Context and middleware. Here is some import things. middleware When deploying Next.js on Vercel, Middleware runs in the Edge Runtime (V8), while API Routes and other server-side logic run in Node.js Serverless Functions. Middleware is ideal for request interception, authentication, redirects, and lightweight modifications....

March 4, 2025

Building a Website With Laravel and Nextjs Part 1 : Laravel

Recommended API Response Format { "success": true|false, "data": {}, "message": "Human readable message", "errors": {} } Advantages of This Format : Clear success/failure indicator: The success field explicitly indicates whether the request was successful Separation of data and messages: data contains the actual response data, while message provides a user-friendly description Structured error information: The errors field can contain field-level validation errors when needed Consistency: All API endpoints use the same format, simplifying frontend handling Self-documenting: The response structure is intuitive and communicates its purpose clearly Flexibility: Works well for both simple and complex responses across different types of operations Frontend compatibility: Makes it easier to implement consistent UI feedback based on standardized response structure

March 4, 2025

The Faq on How to Use Docusaurus to Create a Website

February 12, 2025

Daily Brainstorming : How to Evaluate Whether a New Project Is Good

I am a software engineer, and sometimes I feel like a man with a hammer seeing everything as a nail. I’ve been in this field for a long time and have often noticed that doing more doesn’t always lead to better results. The question is: how can I evaluate whether a new project is good? there are two axes to consider when selecting an project: feasibility value Feasibility is how easy it is to do the project, and value is how much value the project will deliver to the business....

January 7, 2025

New Year Holiday Reading Book 3 How to Raise a Tech Genius

Recommendation Rating: ★★☆☆☆ The best way to teach someone to learn something is by helping them experience it and solve real-world problems. However, compared to a standard curriculum, this approach requires much more skilled teachers, is harder to standardize, and therefore tends to be more expensive. For me, the good thing is that there’s a purpose in teaching kids information technology, which helps me rethink everything I do to better support my kids in using it....

December 31, 2024

New Year Holiday Reading Book 2 Design and Build Great Web Apis

Recommendation Rating: ★★★☆☆ This book has two key features: Every topic starts with the basic fundamentals(not just from software require, from basic thinking); It provides a comprehensive framework of web API It attempts to establish a system, but it lacks rigor and is quite verbose. When it comes to specific operations, it lacks detail. It can only be considered a collection of organized notes with some highlights, but it falls short of being truly good....

December 26, 2024

New Year Holiday Reading Book 1 : Business Intelligence Analytics Data Science and Ai

Recommendation Rating: ★★★☆☆ This book has a lot of information all in one place, and it’s great to flip through. Here are some things I found interesting. Business Analytics When we talk about analytics, it means we aim to understand the current situation, anticipate what might happen, and determine the actions we can take. Dimension Descriptive Predictive Prescriptive Questions What Happened? What will happen? What should I do? - What is happening?...

December 25, 2024

You Do Not Need Learn Everything in the Code

My philosophy is Learn just enough to solve your current problem and expand your understanding naturally as new challenges arise. I have a wide interest in technology, so my biggest challenge is staying focused. So, focus means choosing a field and specializing in it. Principle Understand which level is best for the current problems(Like TCP/IP, HTTP, or user-defined protocols.) The sequence to solve this problem(like sometimes the question is about the user interface, and other times the problem is about creating a more efficient algorithm) Technology Stack

December 19, 2024

How to Fix Replicate Run Error Readablestream in Nextjs

If you try to use Replicate’s Node.js client follow by model pages, like this : const output = await replicate.run("black-forest-labs/flux-schnell", { input }); console.log(output[0]); you will get result : ReadableStream { locked: false, state: 'readable', supportsBYOB: false }. You need change to : const [output] = await replicate.run(model, { input }); console.log(output.url()); More information check doc.

December 5, 2024