DEV Community

Subhendu Das
Subhendu Das

Posted on

Deep Dive: ITR Filing Optimization in DoAide TaxFile

Problem

In India, taxpayers must choose between the old tax regime, which offers a range of deductions, and the new regime, which provides lower tax rates but no deductions. Selecting the optimal regime requires juggling multiple variables: gross income, HRA, capital gains, and specific deductions such as Section 80C and 80D. Manual calculation is error‑prone and time‑consuming, especially for freelancers and first‑time ITR filers.

DoAide TaxFile solves this by presenting a side‑by‑side comparison of the two regimes. The tool calculates the tax payable under each regime based on user‑entered data and displays the difference, allowing the user to see which option saves more money. This is where itr filing pays off in practice.

How It Works

The comparison feature is built around a simple FastAPI endpoint that accepts a JSON payload describing the taxpayer’s financial profile. The payload includes:

  • Gross annual income
  • HRA received and rent paid
  • Capital gains
  • Deductions claimed under Section 80C, 80D, and other applicable sections

The API validates the payload with Pydantic models, queries a PostgreSQL database for current deduction limits, and then performs the tax calculation using the tax slabs defined by the Income Tax Department. The result is a JSON object containing the tax payable under both regimes.

# app/api/compare.py
from fastapi import APIRouter
from pydantic import BaseModel, Field
from typing import Optional

router = APIRouter()

class RegimeRequest(BaseModel):
    income: float = Field(..., gt=0)
    hra: float = Field(0)
    rent: float = Field(0)
    capital_gains: float = Field(0)
    deductions_80c: Optional[float] = Field(0)
    deductions_80d: Optional[float] = Field(0)

@router.post("/compare-regime")
async def compare_regime(req: RegimeRequest):
    # tax calculation logic omitted for brevity
    old_tax = calculate_old(req)
    new_tax = calculate_new(req)
    return {"old": old_tax, "new": new_tax}
Enter fullscreen mode Exit fullscreen mode

The calculate_old function applies the standard deduction, HRA exemption rules, and Section 80C/80D limits pulled from a deductions table in PostgreSQL. The calculate_new function applies the lower tax slabs and skips all deductions. Getting itr filing right early saves rework later.

On the front end, a React component built with Vite fetches the API and renders a comparison table. The component uses useState to hold the result and a simple fetch call to submit the form.

// src/components/RegimeCompare.jsx
import { useState } from "react";

export default function RegimeCompare() {
  const [payload, setPayload] = useState({
    income: 0,
    hra: 0,
    rent: 0,
    capital_gains: 0,
    deductions_80c: 0,
    deductions_80d: 0,
  });
  const [result, setResult] = useState(null);

  const handleSubmit = async (e) => {
    e.preventDefault();
    const res = await fetch("/api/compare-regime", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify(payload),
    });
    const data = await res.json();
    setResult(data);
  };

  return (
    <form onSubmit={handleSubmit}>
      {/* form fields omitted for brevity */}
      <button type="submit">Compare Regimes</button>
      {result && (
        <table>
          <thead>
            <tr>
              <th>Regime</th>
              <th>Tax Payable (₹)</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>Old</td>
              <td>{result.old}</td>
            </tr>
            <tr>
              <td>New</td>
              <td>{result.new}</td>
            </tr>
          </tbody>
        </table>
      )}
    </form>
  );
}
Enter fullscreen mode Exit fullscreen mode

The component is styled with Tailwind CSS, ensuring a responsive layout that works on both desktop and mobile devices. Good itr filing keeps the rest of the workflow predictable.

User Experience

When a user navigates to the Compare Regimes page, they first see a concise explanation of the two tax regimes. Below that is a form with labeled inputs for each financial parameter. As the user types, the form state updates in real time. Upon submission, the page displays a table comparing the tax payable under the old and new regimes.

If the old regime is cheaper, the table highlights the savings and suggests which deductions are most valuable. If the new regime is better, the table shows the lower tax amount and indicates that the user can forego deductions. The interface also provides a link to the Tax Saving Tips blog post for deeper guidance.

Implementation Details

  • Backend: FastAPI (Python 3.12), Pydantic for request validation, SQLAlchemy for database access, PostgreSQL for storing deduction limits.
  • Frontend: React 18, Vite for bundling, Tailwind CSS for styling, and the native fetch API for communication.
  • Deployment: The app is containerized with Docker and deployed to a cloud platform that scales horizontally. The API uses route‑level code splitting to keep the bundle size small, and an error boundary captures any runtime errors.
  • SEO: Each route is prerendered with its own <head> section, canonical tags, and JSON‑LD, ensuring the old vs new tax regime page ranks for relevant searches.

Conclusion

The old‑vs‑new regime comparison tool removes a significant barrier to efficient ITR filing. By automating the calculation and presenting the results in a clear, side‑by‑side format, DoAide TaxFile empowers Indian salaried professionals, freelancers, and first‑time filers to make data‑driven decisions. The underlying FastAPI/React architecture makes the feature reliable, maintainable, and easy to extend with additional tax rules in the future.

Further Reading

  • Belated ITR guide
  • Marginal relief at ₹12L article
  • Delayed refund walkthrough

These resources are available in the blog section, which is automatically included in the sitemap for better discoverability.

Related reading

Top comments (0)