haechandev
Building

Building an Instagram clone, part 1

Choosing Flutter and Firebase for a short development schedule and setting up the initial project.

October 6, 2023

I decided to start building an Instagram-style app.

With a short development schedule, I chose Flutter and Firebase, using a MacBook and VS Code.

Flutter’s hot reload let me check screen changes immediately. Firebase made it straightforward to start authentication and a database from Dart. Those were the main reasons for choosing them.

I first considered which posts should appear on the home screen. Instagram’s actual recommendation algorithm is complex and not public, so I chose a simpler initial flow: show posts from followed accounts in chronological order.

This first entry covers only project setup and the basic Firebase connection.

Create the Flutter project

Create a project in the directory you want.

mkdir instagram
cd instagram
flutter create --platform android,ios instagramclone

I selected Android and iOS because those were the two target platforms.

Create and connect a Firebase project

Create a project in the Firebase Console and connect the Flutter app.

Once connected, initialize Firebase in main before starting the app.

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  runApp(const MyApp());
}

That completes the basic setup. My next step was to implement registration and login.

Original post: View source