DEV Community

Bharti Kumari | Full Stack Developer
Bharti Kumari | Full Stack Developer

Posted on Edited on

From Software Requirement to Backend Architecture with AI2DEV and Odyssey

Building backend systems is rarely just about writing API code.

A real backend project usually includes:

Requirements
APIs
Authentication
Business rules
Database design
Validation
Cloud functions
Infrastructure
Deployment
Monitoring
Enter fullscreen mode Exit fullscreen mode

When developers use AI only for code generation, they often solve these pieces one at a time.

A more structured workflow is to start with the software requirement, generate the technical design, review it, refine it, and then create the project.

That is the kind of workflow supported by AI2DEV and its product Odyssey.


The Problem with Starting Directly from Code

Imagine a client gives us this requirement:

Create a Subscription Management Platform.

Users should be able to:

- Create an account
- Select a subscription plan
- Upgrade or downgrade their plan
- Cancel a subscription
- View billing history
- Manage payment methods

Admins should be able to:

- Create subscription plans
- Update pricing
- View customers
- View subscriptions
- Disable plans

The system should:

- Use REST APIs
- Store data in PostgreSQL
- Use JWT authentication
- Support cloud deployment
- Send notifications
Enter fullscreen mode Exit fullscreen mode

A developer could immediately ask an AI coding tool:

Build this backend.
Enter fullscreen mode Exit fullscreen mode

The AI may start generating:

Controllers
Models
Routes
Services
Repositories
Database queries
Enter fullscreen mode Exit fullscreen mode

But several important architectural decisions still need to be made.

For example:

How should billing events work?

Should payments be synchronous or event driven?

How should plan upgrades be handled?

Where should authentication live?

How should duplicate payments be prevented?

What happens when a payment fails?

How should subscriptions be cancelled?

Should cloud functions be used?
Enter fullscreen mode Exit fullscreen mode

If these decisions are made after the codebase already exists, the project may require significant refactoring.


Start with the Requirement Instead

A better starting point is the full software requirement.

For example:

Build a Subscription Management Platform.

Customers:

- Register and login
- View plans
- Purchase a subscription
- Upgrade subscription
- Downgrade subscription
- Cancel subscription
- View invoices

Admin:

- Create plans
- Update plans
- Disable plans
- View active subscriptions

Technical requirements:

- REST API
- PostgreSQL
- JWT authentication
- Cloud deployment
- Payment provider integration
- Background notification processing
Enter fullscreen mode Exit fullscreen mode

This requirement describes the actual application rather than the framework implementation.


Generate the Software Design with Odyssey

Odyssey can be used to turn the requirement into a structured software design.

The design can describe areas such as:

Application overview

API endpoints

Request fields

Response fields

Database entities

Business rules

Validation rules

Cloud functions

Authentication

Security

Deployment architecture
Enter fullscreen mode Exit fullscreen mode

This gives developers a chance to inspect the system before implementation begins.


Step 1: Design the Main APIs

The subscription API might include:

POST /auth/register
POST /auth/login

GET /plans
GET /plans/{planId}

POST /subscriptions
GET /subscriptions/{subscriptionId}
PATCH /subscriptions/{subscriptionId}
DELETE /subscriptions/{subscriptionId}

GET /customers/{customerId}/subscriptions
GET /customers/{customerId}/invoices
Enter fullscreen mode Exit fullscreen mode

Admin APIs could include:

POST /admin/plans
PUT /admin/plans/{planId}
DELETE /admin/plans/{planId}

GET /admin/customers
GET /admin/subscriptions
Enter fullscreen mode Exit fullscreen mode

Now the API surface is visible before any controllers are generated.


Step 2: Define the Database

The design might identify entities such as:

User
Plan
Subscription
Payment
Invoice
PaymentMethod
Notification
Enter fullscreen mode Exit fullscreen mode

A simplified relationship could look like:

User
 |
 | 1
 |
 | N
Subscription
 |
 | N
 |
 | 1
Plan

Subscription
 |
 | 1
 |
 | N
Payment

Subscription
 |
 | 1
 |
 | N
Invoice
Enter fullscreen mode Exit fullscreen mode

This makes the domain model much easier to understand.


Example Subscription Table

CREATE TABLE subscriptions (
    id UUID PRIMARY KEY,
    user_id UUID NOT NULL,
    plan_id UUID NOT NULL,
    status VARCHAR(50) NOT NULL,
    started_at TIMESTAMP NOT NULL,
    expires_at TIMESTAMP,
    cancelled_at TIMESTAMP,
    created_at TIMESTAMP NOT NULL,
    updated_at TIMESTAMP NOT NULL
);
Enter fullscreen mode Exit fullscreen mode

Possible statuses might be:

ACTIVE
PAST_DUE
CANCELLED
EXPIRED
PENDING
Enter fullscreen mode Exit fullscreen mode

Step 3: Define Business Rules

Business rules are one of the most important parts of the design.

For example:

A user can have only one active subscription.

A cancelled subscription cannot be cancelled twice.

Users cannot subscribe to disabled plans.

A downgrade may become active at the next billing cycle.

An upgrade may become active immediately.

A failed payment should not activate the subscription.

Only admins can create or update plans.
Enter fullscreen mode Exit fullscreen mode

These rules are more important than the framework being used.

They define how the product actually behaves.


Step 4: Define Validation

For example, creating a plan might require:

{
  "name": "Pro",
  "price": 49.99,
  "billingCycle": "MONTHLY",
  "currency": "USD"
}
Enter fullscreen mode Exit fullscreen mode

Validation rules could include:

Name is required.

Price must be greater than zero.

Currency must be supported.

Billing cycle must be MONTHLY or YEARLY.
Enter fullscreen mode Exit fullscreen mode

An invalid request could return:

{
  "error": "VALIDATION_ERROR",
  "message": "Invalid plan data",
  "fields": {
    "price": "Price must be greater than zero"
  }
}
Enter fullscreen mode Exit fullscreen mode

Step 5: Separate Synchronous and Background Work

Not everything needs to happen inside the main API request.

For example, subscription creation might follow this flow:

Client
  ↓
Create Subscription API
  ↓
Validate Request
  ↓
Create Payment
  ↓
Save Subscription
  ↓
Publish Event
  ↓
Return Response
Enter fullscreen mode Exit fullscreen mode

Background processing can then handle:

SubscriptionCreated Event
        ↓
 ┌──────────────┬─────────────────┐
 ↓              ↓                 ↓
Invoice      Email            Analytics
Worker       Worker            Worker
Enter fullscreen mode Exit fullscreen mode

This can improve reliability and keep API requests faster.


Step 6: Use AWS Lambda or Azure Functions

Some background tasks are well suited for serverless functions.

For example:

SendWelcomeEmailFunction

CreateInvoiceFunction

RetryFailedPaymentFunction

SubscriptionExpiryFunction

PaymentWebhookFunction
Enter fullscreen mode Exit fullscreen mode

On AWS:

API Gateway
    ↓
AWS Lambda
    ↓
PostgreSQL / RDS
    ↓
EventBridge / SQS
Enter fullscreen mode Exit fullscreen mode

On Azure:

API Management
      ↓
Azure Functions
      ↓
Azure PostgreSQL
      ↓
Service Bus
Enter fullscreen mode Exit fullscreen mode

The same software requirement can be mapped to different cloud providers.


Step 7: Add Authentication

Authentication can be defined before coding begins.

For example:

POST /auth/login
Enter fullscreen mode Exit fullscreen mode

Request:

{
  "email": "developer@example.com",
  "password": "********"
}
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "accessToken": "jwt-token",
  "expiresIn": 3600
}
Enter fullscreen mode Exit fullscreen mode

Protected APIs can require:

Authorization: Bearer <token>
Enter fullscreen mode Exit fullscreen mode

The design can also define roles:

CUSTOMER

ADMIN
Enter fullscreen mode Exit fullscreen mode

And permissions:

CUSTOMER
- View plans
- Manage own subscription
- View own invoices

ADMIN
- Manage plans
- View customers
- View all subscriptions
Enter fullscreen mode Exit fullscreen mode

Step 8: Add Payment Webhooks

Payment systems usually communicate asynchronously using webhooks.

For example:

POST /webhooks/payment
Enter fullscreen mode Exit fullscreen mode

Possible events:

payment.success

payment.failed

subscription.renewed

subscription.cancelled
Enter fullscreen mode Exit fullscreen mode

A webhook handler could follow:

Payment Provider
      ↓
Webhook API
      ↓
Verify Signature
      ↓
Check Idempotency
      ↓
Update Payment
      ↓
Update Subscription
      ↓
Publish Event
Enter fullscreen mode Exit fullscreen mode

The idempotency step is important because payment providers may retry webhook deliveries.


Step 9: Refine the Design Before Code Generation

Suppose the application needs additional requirements later.

You might refine the design with:

Add:

- Redis caching
- Rate limiting
- Payment retry logic
- Dead-letter queues
- Multi-region deployment
- Audit logs
- Admin activity tracking
- Observability
Enter fullscreen mode Exit fullscreen mode

Now the architecture can evolve before implementation becomes expensive to change.


Example Scalable Architecture

                ┌──────────────┐
                │   Frontend   │
                └──────┬───────┘
                       ↓
                ┌──────────────┐
                │ API Gateway  │
                └──────┬───────┘
                       ↓
            ┌───────────────────────┐
            │ Subscription Service  │
            └──────────┬────────────┘
                       ↓
                 ┌──────────┐
                 │PostgreSQL│
                 └──────────┘

                       ↓

                 Event Queue
                       ↓
        ┌──────────────┼──────────────┐
        ↓              ↓              ↓

    Payments       Notifications    Invoices
    Worker          Worker           Worker
Enter fullscreen mode Exit fullscreen mode

This is much easier to review as a design than after hundreds of files already exist.


From Odyssey to AI2DEV

Once the design is ready, the next step is creating the project.

A simplified workflow becomes:

Software Requirement
        ↓
Odyssey
        ↓
Generate Design
        ↓
Review
        ↓
Refine
        ↓
Create AI2DEV Project
        ↓
Deployment
Enter fullscreen mode Exit fullscreen mode

This connects architecture work with the broader AI2DEV development workflow.


Why Design-First Development Matters

AI makes generating code faster.

But faster generation does not automatically mean better software.

A badly designed architecture can also be generated quickly.

The important part is making good decisions before generating large amounts of implementation.

For example:

Bad workflow:

Generate
   ↓
Discover problem
   ↓
Rewrite
   ↓
Discover another problem
   ↓
Rewrite again
Enter fullscreen mode Exit fullscreen mode

Compared with:

Requirement
   ↓
Design
   ↓
Review
   ↓
Refine
   ↓
Generate
Enter fullscreen mode Exit fullscreen mode

The second workflow can reduce unnecessary implementation changes.


AI2DEV as the Main Platform

AI2DEV is the main platform around the broader development workflow.

Odyssey works as one product within that ecosystem.

A simplified view is:

AI2DEV
│
├── Project generation
├── Cloud workflows
├── Infrastructure
├── Deployment
├── CI/CD
│
└── Odyssey
    ├── Software requirements
    ├── Design generation
    ├── Design refinement
    ├── Engineering questions
    └── Create AI2DEV project
Enter fullscreen mode Exit fullscreen mode

This creates a workflow that goes beyond simply asking an AI model to output source code.


Where This Approach Helps Most

A structured design-first workflow becomes more useful when the application includes:

Multiple APIs

Authentication

Complex business logic

Payment systems

AWS Lambda

Azure Functions

Database relationships

Cloud infrastructure

Background jobs

Event-driven processing

Production deployment
Enter fullscreen mode Exit fullscreen mode

The more moving pieces a project has, the more valuable an explicit design becomes.


Final Thoughts

AI-assisted software development does not have to start with:

Write the code.
Enter fullscreen mode Exit fullscreen mode

It can start with:

Understand the software.
Enter fullscreen mode Exit fullscreen mode

Then move through:

Requirement
    ↓
Architecture
    ↓
Business Rules
    ↓
APIs
    ↓
Database
    ↓
Cloud Functions
    ↓
Project
    ↓
Deployment
Enter fullscreen mode Exit fullscreen mode

That is where tools like Odyssey and the broader AI2DEV platform become useful.

Instead of treating AI as only a coding assistant, developers can use it earlier in the lifecycle to structure the system before implementation starts.

AI2DEV: https://ai2dev.com/

Odyssey: https://odyssey.ai2dev.com/


Would you rather generate code immediately, or review the complete architecture before creating the project?

Top comments (0)