Hi everyone,
I’ve been working on an AI companion platform inspired by apps like Rosely AI. My goal isn’t to clone the product feature-for-feature, but to understand how modern AI companion applications are architected and how to build something scalable using current AI APIs.
Instead of training my own large language model, I decided to use the ChatGPT API as the conversational engine and focus on building the surrounding infrastructure.
I’d love to get some feedback from developers who have built AI-powered applications or worked with LLMs in production.
Current Tech Stack
Frontend
- Next.js
- TypeScript
- Tailwind CSS
Backend
- Node.js
- Express
- PostgreSQL
- Redis
AI Services
- ChatGPT API
- AI Image Generation API
- Text-to-Speech API
Features Implemented
The application currently includes:
- AI chat with multiple personalities
- Conversation history
- User authentication
- AI-generated images
- Voice replies
- Subscription system
- Mobile-friendly interface
One thing I noticed while studying platforms like Rosely AI is that the overall experience depends much more on memory and personalization than simply using a powerful language model.
Memory Architecture
This has probably been the most interesting part of the project.
Rather than sending the complete chat history with every request, I’m testing a layered memory system.
Current flow:
- Recent conversation for context
- User profile and preferences
- Long-term memory summaries
- Retrieved memories relevant to the current message
This significantly reduces token usage while making conversations feel more consistent.
Has anyone here tried retrieval-based memory or another approach?
Prompt Engineering
Another challenge has been prompt management.
Currently each request is built from:
- System instructions
- Character personality
- User profile
- Memory context
- Recent conversation
- Current message
Even small prompt adjustments noticeably change the AI’s behavior.
I’d be interested to hear how others structure prompts for long-running conversations.
Performance & Scaling
As I add more concurrent users, API latency becomes more noticeable.
I’m currently exploring:
- Streaming responses
- Redis caching
- Background job queues
- Horizontal scaling
- Better database indexing
If you’ve optimized an AI application, what had the biggest impact on response time?
Image Generation
Image generation runs as a separate service rather than inside the chat pipeline.
The workflow is:
- User requests an image.
- Backend validates the request.
- AI image service processes it.
- Image is stored and returned asynchronously.
This keeps the chat interface responsive while images are being generated.
Looking for Advice
I’d appreciate feedback on:
- AI memory systems
- Prompt engineering
- API cost optimization
- Scaling Node.js applications
- WebSocket architecture
- AI moderation
- Database design for AI chats
If you’ve built an AI chatbot, AI companion, or another LLM-powered SaaS application, I’d love to hear what worked well and what challenges you faced.