In this tutorial, we will walk through the process of building a full-stack React Native app with payments using PostgreSQL, TypeScript, Stripe, and Tailwind CSS. By the end, you will have a fully functional app that allows users to make payments for goods or services.
Here’s what we’ll cover in this tutorial:
- Setting up a new React Native project
- Configuring TypeScript and PostgreSQL
- Implementing payment processing with Stripe
- Styling our app with Tailwind CSS
Let’s get started!
Step 1: Setting up a new React Native project
First, make sure you have Node.js and npm installed on your machine. You can check this by running the following commands in your terminal:
node -v
npm -v
If you don’t have Node.js or npm installed, you can download and install them from the official website.
Next, install the React Native CLI globally by running the following command:
npm install -g react-native-cli
Create a new React Native project by running the following command:
react-native init PaymentApp
Navigate to the project directory:
cd PaymentApp
Now we have a basic React Native project set up to start building our app.
Step 2: Configuring TypeScript and PostgreSQL
To configure TypeScript in our project, run the following command to install the necessary packages:
npm install --save-dev typescript @types/react @types/react-native @types/react-test-renderer
Create a tsconfig.json file at the root of your project with the following content:
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"jsx": "react",
"strict": true
}
}
Next, we need to set up a PostgreSQL database for our app. You can download and install PostgreSQL from the official website or use a cloud-based solution like Heroku.
Once you have PostgreSQL set up, create a new database for our app:
createdb payment_app
Step 3: Implementing payment processing with Stripe
To implement payment processing in our React Native app, we will be using the Stripe API. First, create a Stripe account at stripe.com.
Install the Stripe SDK for React Native by running the following command:
npm install @stripe/stripe-react-native
Next, in your project’s root directory, create a new file called stripe.config.ts and add the following code:
export const STRIPE_PUBLISHABLE_KEY = 'YOUR_STRIPE_PUBLISHABLE_KEY';
Replace YOUR_STRIPE_PUBLISHABLE_KEY with your actual publishable key from your Stripe dashboard.
Now, we can start implementing payment processing in our app using the Stripe API. You can refer to the official Stripe documentation for more information on how to handle payments.
Step 4: Styling our app with Tailwind CSS
To style our app, we will be using Tailwind CSS. Install Tailwind CSS by running the following command:
npm install tailwindcss
Create a tailwind.config.js file at the root of your project with the following content:
module.exports = {
purge: [],
darkMode: false,
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}
Next, create a styles.css file in the assets folder of your project and import Tailwind CSS:
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
Import the styles.css file in your App.js file:
import "./assets/styles.css";
Now, you can start using Tailwind CSS classes to style your React Native components. You can refer to the official Tailwind CSS documentation for more information on how to use the utility classes.
That’s it! You have now successfully built a full-stack React Native app with payments using PostgreSQL, TypeScript, Stripe, and Tailwind CSS. Feel free to customize and expand upon this app to meet your specific requirements. Happy coding!
Yes, I switched to WebStorm, check it out, and I'm sure you'll love it too! https://jb.gg/JSMastery ⭐
Super tutorial, can you tell me how the driver will receive the booked ride and accept it or reject it. Will make an app tutorial for the driver to manage their booked rides and ride to the client?
Why expo? Why not cli?
You can make anything , so take a challenge make a app so we can book real world flight booking app
Can you make a project about selling used car with each information with different car?
50:11 like on tinder 😂😂 now we know that jsm is using tinder
Great. Next video on Visual Studio clone please, thank you
Seriously? I cannot find a single thing that is missing. This is not a course. This is the complete needs
Your resources are priceless, thank you
This channel is gold
Thanks!
next time start project with create expo stack faster
Clerk is a deal killer. Use a diffrent auth
I just finished watching and writing the code for the course. Thank you very much! 🙌🏻
I don't know what i do wrong, but my Nativewind isn't working at all… Already cleared my cache and after that it still doesn't work.
how will the driver confirm
I have mailed twice regarding refund for NEXT js course please check it , Thank You
I have a problem with tokenCache, it always appear error "No values stored under key" everytime I reload and also it does not save my session after logged in
Oh this makes me serious with mobile app. Thanks a lot indeed!!!
Love this project so much! But I ran into the case where after applied Clerk to the authentication, my project just doesn't seem to render the pages (I was using expo go, it works fine. But when I switch to android studio this happened), I would be very appreciated if anyone know why