Homepage
Examples
User Management Platform

User Management Platform

This tool consolidates user data, payment history, and token usage into one dashboard for managing customers and handling support requests.
THE CHALLENGE

Customer support requires juggling multiple systems to answer basic questions

Support tickets come in asking about account status, payment history, or usage limits. Answering requires checking Stripe for payments, your database for user details, and logs for token consumption. Each question means switching between three systems. Issuing refunds takes multiple steps. Generating receipts requires manual work. By the time you've gathered information from everywhere, you've spent 10 minutes on what should be a 2-minute response.

About this tool

Tool Description

This dashboard brings user data into one place. Search for any user and see their complete profile: account details, payment history from Stripe, and token usage over time. Issue refunds directly from the interface. Generate and email PDF receipts with billing details. Top up tokens when needed. The token usage chart shows daily consumption patterns to identify unusual activity.

Key Features

User search by name or email, payment history from Stripe integration, token consumption tracking with daily charts, refund processing, PDF receipt generation and email delivery, billing details management, token balance top-ups, free plan and paid plan status visibility, and dual MongoDB connections (internal and external).

Result

The support team stopped switching between tools to help one customer. They can now search a user, see everything, and fix issues from the same screen.

Prompts used to build this app

1173 lines of code

💬 16 prompts used

1173 lines of code

🪙 9M tokens

Prompt 
User Management Platform 1

I want to build an app that on the home page after the user is authenticated sees a search bar where I can search users by name or by the email. Then when users are fetched I should be able to click and open up the user page. On the user page I should be able to see a user's email, user's name, when did they joined. This is a createdAt parameter in the users collection. I should be able to see clearly if they are on the paid plan or a free plan. I should be able to see their payments and their token usage. If they are on the paid plan I should be able to cancel their subscription and if I cancel it after the confirmation pop-up the user should get a confirmation email that their subscription has been cancelled.

In the Payments section, I should be able to see user's payment history in a list (date of the payment, amount). This should be connected with Stripe, and in Stripe search for all the payments by the customerId. For each of the payments, I should be able to issue a refund and generate a PDF receipt. Once the receipt is generated, I should be able to download it or automatically send it in an email to the user. I should be able to edit user's billing details. By default, fetch the user's billing details from Stripe, but I also want to be able to change the billing details, save them in the internal database. So if there are billing details in the internal database, then fetch that data, and if not, fetch the data from Stripe, and I should be able to turn on automatically receipt sending over email. So if I do that, whenever a user does a payment, we should automatically send them an email with the receipt and their billing details.

In the Token Consumption section, I should be able to see a bar chart by days with the token consumption for each of the days. I should be able to generate a PDF like a receipt with token consumption. I should be able to choose a date range and generate a PDF, and in it, there should be all token consumption by day in a list. Also, I should be able to give free tokens. I should be able to see the current token balance and top up the tokens. I should be able to just add a number and give free tokens. I also want to have a confirmation pop-up for that, and once I do that, send an email confirmation to the user about the free tokens.

As for the implementation details, we want to use the internal database that comes with a template and another MongoDB database (external database) that I will add different MongoDB connection details.

Prompt 
User Management Platform 2

🟡 Prompt 2

Implement the backend for the home page so I can search users in the external database and open their profile. Make sure to separately connect to the external database from the current local database. The external db is also mongo db.

Prompt 
User Management Platform 3

User page doesn't work - please implement the basic functionality to fetch the basic user data and show it on the page.

Prompt 
User Management Platform 4

Please connect the customers collection to the users data on the user's page and show the current token balance (that is the field tokensLeft in the external database), and the token usage by connecting the llmreqs collection.

Prompt 
User Management Platform 5

Now, the home page got broken(it worked before) and it seems like I don't have any users.

Prompt 
User Management Platform 6

Great, I can see the current token balance now but I cannot see the daily token consumption - please fix.

Prompt 
User Management Platform 7

I can see the detailed token usage (each usage individually) but I cannot see it grouped by days. Please enable grouping of tokens by days (you can do it in a db query) in the detailed breakdown (I want to see a list of usage by days there) and fix the chart - it's not showing anything currently.

Prompt 
User Management Platform 8

Ok, great. Now, I can see the daily usage grouped but the chart is still empty and the TOTAL TOKENS in the list is always 0. Please fix and make it so that the Daily Usage Breakdown shows the token usage in the same period as on the chart. I want to be able to choose this from the date picker.

Prompt 
User Management Platform 9

Ok, this works perfect now!!! Can you make all the places where tokens are shown to be shown as 10M instead of 10,000,000, 10k instead of 10,000, etc. You can ignore decimal points and less than 1000 tokens.

Also, can you make FROM and TO calendars to be one calendar on which I choose a range.

Prompt 
User Management Platform 10

Please implement the connection to Stripe - pulling of the biliing details, editing the billing details and saving them to the database, getting the payment history, generating the receipt for each specific payment and issuing a refund. Also, implement sending emails - receipts and the automatic sending of receipts.

Prompt 
User Management Platform 11

I don't see any payments even though I know I should see them. Please tell me how are you getting the payments and check if it's the same as noted in the specification.

Prompt 
User Management Platform 12

Ok, great, I can see the payments but there are a few issues:

  1. I see some weird payments of $29.99 on February 14, 2025, January 21, 2025 and January 18, 2025 - there are no such payments. Please check what is with this.
  2. For billing details, I only see "undefined" - you can leave them blank until I change them myself. You don't have to get them from Stripe.
  3. If I try Editing the billing details, I get an error. I want to save this data into the internal database, not the external one.
  4. Generating a receipt doesn't work. I get an error.

Prompt 
User Management Platform 13

I still cannot download the invoice nor send it via email. Please fix. You can create the invoice from the fetched data. also, the company name for the invoice is Pythagora Technologies Inc. Great, I can generate the PDF now - it looks good but it doesn't add the Billing details under the "Bill to:" section.

Prompt 
User Management Platform 14

This works great. Now, please do the following changes:

  • On the top of the page put the value user.fullName and under it, the email. Also, on the invoice, in the Bill to section, add only the billing details that I added on the user page.
  • for the receipt number, take the receipt number from stripe - it should be something like 2615-8081

Prompt 
User Management Platform 15

Implement topping up tokens by making this POST request:curl -X POST http:s//api.pythagora.ai/add-tokens
-H "Content-Type: application/json"
-d '{"apiKey": "your-api-key-here","userId": "<user_id>","tokens": 1000}'

the apiKey should be set in the .env file and the userId should be fetched for that user._id

Also, implement cancelling of the subscription on stripe.

💬 prompts used

🪙 tokens

Share this post