A visual drag-and-drop neural network designer that generates clean PyTorch code. I built this to make deep learning more accessible and to bridge the gap between visual design and actual implementation.
Try it live at: buildaneural.net
As someone learning deep learning, I found it frustrating to translate neural network architectures from papers into actual code. I wanted a tool that would let me design networks visually and then generate the PyTorch implementation automatically.
- Visual Design: Drag and drop layers to build your network architecture
- Real-time Validation: See connection errors and type mismatches as you build
- Code Generation: Get clean, runnable PyTorch code from your visual design
- Save & Load: Keep your designs and iterate on them
- User Accounts: Sign up to save your models in the cloud
Frontend:
- React 18 with TypeScript
- React Flow for the visual editor
- Tailwind CSS for styling
- Zustand for state management
Backend:
- FastAPI (Python)
- SQLAlchemy for database ORM
- JWT authentication
- SQLite/PostgreSQL
The editor validates connections between layers in real-time, checking tensor dimensions and data types to prevent common mistakes.
Detailed layer information and parameter tooltips help users understand each component while building their networks.
Instead of just dumping layers together, the generator creates properly structured PyTorch classes with:
- Proper imports and dependencies
- Clean forward() methods
- Training loops with optimizers
- Example usage code
- Clone and install:
git clone https://github.com/JavaNoTea/BuildANeuralNet.git
cd BuildANeuralNet
npm install- Set up the backend:
cd apps/api
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python migrate_database.py- Start development servers:
# Backend (from apps/api)
uvicorn main:app --reload
# Frontend (from apps/web)
npm run devCreate apps/api/.env:
SECRET_KEY=your-secret-key-here
ENCRYPTION_KEY=your-encryption-key-here
DATABASE_URL=sqlite:///./nn_builder.db
# Optional: Email verification
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password- Design: Drag layers from the sidebar onto the canvas
- Connect: Link layers by dragging from output to input ports
- Configure: Click layers to set parameters (sizes, activations, etc.)
- Generate: Hit the code button to get your PyTorch implementation
- Export: Copy the code or save your design
import torch
import torch.nn as nn
import torch.nn.functional as F
class NeuralNetwork(nn.Module):
def __init__(self):
super(NeuralNetwork, self).__init__()
self.fc1 = nn.Linear(784, 128)
self.fc2 = nn.Linear(128, 64)
self.fc3 = nn.Linear(64, 10)
def forward(self, x):
x = x.view(x.size(0), -1)
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = self.fc3(x)
return x
# Training setup
model = NeuralNetwork()
criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), lr=0.001)I deployed this on Railway for free hosting. The app uses Docker for easy deployment anywhere.
- Type Safety: Ensuring layer connections are valid at design time
- State Management: Keeping the visual editor and property panel in sync
- Code Generation: Translating visual graphs into clean, readable code
- User Experience: Making drag-and-drop feel natural and responsive
- Add more layer types (LSTM, Transformer blocks)
- Model visualization and architecture diagrams
- Integration with popular datasets
- Model performance predictions
Feel free to open issues or submit PRs! I'm always looking to improve this tool.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
The GPL v3 license ensures that any derivative work must also be open source under the same license terms.




