How I built an AI SaaS with Next.js, FastAPI, and Dokploy

Published: (March 20, 2026 at 11:53 PM EDT)
3 min read
Source: Dev.to

Source: Dev.to


โš ๏ธ Collection Error: Content refinement error: Error: 429 429 Too Many Requests: you (bkperio) have reached your weekly usage limit, upgrade for higher limits: https://ollama.com/upgrade


Hey folks! ๐Ÿ‘‹ wan2-7.io, and I wanted to share the exact tech stack and architecture I used to bring it to life without breaking the bank. If you are looking to build a full-stack AI SaaS, I hope this breakdown saves you some time and headache. Letโ€™s dive in! ๐Ÿš€ ๐Ÿ› ๏ธ The Tech Stack Frontend: Next.js (App Router) + Tailwind CSS Backend: Python + FastAPI Infrastructure: Hetzner Cloud + Dokploy (Self-hosted PaaS) Database: PostgreSQL The Frontend: Next.js + Tailwind CSS For the user interface, Next.js is my go-to. Since wan2-7.io relies heavily on visual outputs and smooth user interactions, I needed something that handles state well while still being great for SEO. Tailwind CSS made it incredibly fast to style the components. One of the biggest challenges in AI apps is the waiting stateโ€”when the user hits โ€œGenerateโ€, you need to keep them engaged. I used some clean Tailwind animations to build the loading skeletons. JavaScript // [Optional: Insert a small, cool React component snippet here, // e.g., your loading state or how you handle the fetch request to your API]

The Backend: FastAPI When it comes to wrapping AI models, Python is king. I chose FastAPI because it is incredibly fast, easy to write, and natively supports asynchronous programmingโ€”which is mandatory when you are waiting for AI generation tasks to complete. Instead of blocking the main thread, FastAPI handles the incoming requests, queues the tasks, and allows the Next.js frontend to poll for the result (or listen via Webhooks). The Secret Weapon for Solo Devs: Dokploy + Hetzner This is where I saved the most money and time. Instead of paying premium prices for Vercel, Heroku, or Render, I decided to self-host. I spun up a cheap, high-performance VPS on Hetzner and installed Dokploy (an amazing open-source alternative to Vercel/Heroku). Dokploy connects directly to my GitHub repository. Now, whenever I push code, Dokploy automatically builds the Docker images and deploys my Next.js and FastAPI apps with zero downtime. It gives me the โ€œVercel-likeโ€ developer experience but at a fraction of the cost, giving my indie hacking budget a lot more breathing room. ๐Ÿ’ก The Biggest Lesson Learned Donโ€™t rely on long-polling if you can avoid it. * Always implement proper error handling on the frontend for when (not if) the AI provider times out. Wrapping Up wan2-7.io has been an awesome journey in optimizing both code and infrastructure. If youโ€™re an indie developer, I highly recommend giving the Dokploy + Hetzner combo a try for your next side project. If you want to see how snappy this architecture feels in production, feel free to play around with the live app at wan2-7.io. Let me know if you manage to break it, or if you have any questions about setting up Dokploy and FastAPI! Iโ€™ll be hanging out in the comments. ๐Ÿ‘‡

0 views
Back to Blog

Related posts

Read more ยป

Agents in 60 lines of python : Part 3

The Agent Loop The entire AI agent stack in 60 lines of Python. You've seen Claude search files, read them, then search again. ChatGPT with Code Interpreter wri...