Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ALEJ4NDRO2025/urban-store/llms.txt

Use this file to discover all available pages before exploring further.

Urban Store integrates four external services to handle data persistence, payments, image storage, and transactional email. Each service requires an account and a set of credentials that must be added to your local .env files before the application will start successfully. This guide walks through the setup process for each service from scratch.

MongoDB Atlas

Urban Store uses MongoDB as its primary database through MongoEngine. The database name is urbanstore. While a local MongoDB instance is included in docker-compose.yml for development convenience, Atlas is recommended for any environment where data persistence and availability matter.
1

Create a free cluster

Go to mongodb.com/atlas and sign up or log in. Create a new project, then click Build a Database and select the Free (M0) tier. Choose your preferred cloud provider and region.
2

Create a database user

In the Atlas UI, navigate to Database Access and click Add New Database User. Choose Password authentication, enter a username and a strong password, and grant the user Read and write to any database privileges. Save the credentials — you will need them in the connection string.
3

Whitelist your IP address

Navigate to Network Access and click Add IP Address. For local development you can click Allow Access from Anywhere to add 0.0.0.0/0. For production, restrict this to the specific IP address of your server.
4

Get the connection string

Return to your cluster, click Connect, and choose Drivers. Select Python as the driver. Copy the connection string — it looks like:
mongodb+srv://<username>:<password>@cluster0.abcde.mongodb.net/?retryWrites=true&w=majority
Replace <username> and <password> with the credentials you created in step 2.
5

Set MONGODB_URI

Add the database name to the connection string and paste it into backend/.env:
MONGODB_URI=mongodb+srv://myuser:mypassword@cluster0.abcde.mongodb.net/urbanstore
6

Confirm the database name

The application connects to the database named urbanstore (configured in config/settings.py via mongoengine.connect(db='urbanstore', host=config['MONGODB_URI'], ...)). Ensure the database name at the end of your URI matches, or that you are using the explicit db= parameter in the connection call.

Stripe

Urban Store uses Stripe to process card payments. The backend uses stripe (Python SDK) to create and confirm payment intents; the frontend uses Stripe.js loaded with the publishable key.
1

Create a Stripe account

Go to stripe.com and sign up. You do not need to activate your account to use test mode.
2

Open the API keys page

In the Stripe Dashboard, click Developers in the top navigation bar, then select API keys.
3

Copy the secret key

Copy the Secret key (begins with sk_test_) and set it in backend/.env:
STRIPE_SECRET_KEY=sk_test_51...
4

Copy the publishable key

Copy the Publishable key (begins with pk_test_) and set it in both environment files:
# backend/.env
STRIPE_PUBLISHABLE_KEY=pk_test_51...

# frontend/.env.local
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_51...
5

Test with a test card

Use Stripe’s built-in test card to simulate successful payments without real charges:
FieldValue
Card number4242 4242 4242 4242
ExpiryAny future date, e.g. 12/26
CVCAny 3 digits, e.g. 123
ZIPAny 5 digits, e.g. 10001

Cloudinary

Urban Store stores all product images as Cloudinary secure URLs. The backend is configured with your Cloudinary credentials in config/settings.py via the cloudinary Python SDK. Images are uploaded manually through the Cloudinary dashboard or Media Library, and the resulting URLs are stored in the product’s images array.
1

Create a Cloudinary account

Go to cloudinary.com and sign up for a free account.
2

Find your credentials

After logging in, the Dashboard page immediately shows your three credentials:
  • Cloud name
  • API Key
  • API Secret
3

Set the environment variables

Copy all three values into backend/.env:
CLOUDINARY_CLOUD_NAME=my-cloud-name
CLOUDINARY_API_KEY=123456789012345
CLOUDINARY_API_SECRET=abcdefghijklmnopqrstuvwxyz12345
4

Upload product images

Use the Media Library in the Cloudinary dashboard to upload your product images. After uploading, click on an image and copy its Secure URL — it will look like:
https://res.cloudinary.com/my-cloud-name/image/upload/v1234567890/products/my-product.jpg
5

Add URLs to products

Paste the secure URLs into the images array when creating or editing a product via POST /api/products/ or PUT /api/products/<slug>/.

Gmail SMTP

Urban Store sends transactional emails (order confirmations, etc.) through Gmail SMTP using a custom email backend defined in config/email_backend.py. This backend handles SSL certificate configuration using certifi to ensure reliable TLS connections across operating systems.
You must use a Gmail App Password, not your regular Gmail account password. Attempting to use your standard password will result in authentication failures because Google blocks direct password login for SMTP when 2-Step Verification is enabled.
1

Enable 2-Step Verification

Go to myaccount.google.com/security and enable 2-Step Verification on the Google account you will use to send emails. App Passwords are only available after this step is complete.
2

Open App Passwords

Still on the Security page, scroll to the 2-Step Verification section and click on it. At the bottom of that page you will find App Passwords — click it. If you don’t see this option, 2-Step Verification may not be fully enabled yet.
3

Create an App Password

In the App Passwords dialog, select Mail as the app and Other (custom name) as the device. Enter a name like Urban Store and click Generate. Google will display a 16-character password in a yellow box — copy it immediately, as it will not be shown again.
4

Set EMAIL_HOST_USER

Add your full Gmail address to backend/.env:
EMAIL_HOST_USER=your-store-email@gmail.com
5

Set EMAIL_HOST_PASSWORD

Add the 16-character App Password (you can include or omit the spaces):
EMAIL_HOST_PASSWORD=abcd efgh ijkl mnop
Urban Store uses a custom email backend at config/email_backend.py (CustomEmailBackend) rather than Django’s built-in django.core.mail.backends.smtp.EmailBackend. This custom backend explicitly sets the SSL context using certifi’s certificate bundle, which resolves SSL certificate verification errors that can occur on certain Linux and macOS configurations when connecting to smtp.gmail.com.

Build docs developers (and LLMs) love