iTranslated by AI
[Solo Dev] How Building a Rakuten Market Campaign Optimizer as a Beginner Landed Me My First Dev Project
Introduction
Since I originally only had development experience in Java, I wanted to gain experience in at least one more language that I could include in my portfolio, so I decided to build an application using a modern stack.
My background is as follows:
- Graduated from a programming vocational school
- Java Silver, Oracle Bronze SQL
- No professional experience
In this state, as a complete beginner to TypeScript, I spent one month building this on my own by making full use of Google search and ChatGPT.
There are no tests, and the design might be messy from a professional's perspective.
Unlike the "super-strong junior engineers" with incredible comprehension skills who occasionally appear on Qiita or Zenn, I haven't produced much output, and I don't understand everything yet.
To veteran engineers, this might seem inadequate, but I hope you can look at it with a kind eye...!
I would be happy if this serves as a reference for other beginners who want to build web apps.
Overview
I created a point calculation tool to conquer a Rakuten Ichiba campaign called the "Shopping Marathon." On Rakuten Ichiba, there are roughly three types of campaigns:
- SPU (Super Point Up): A permanent campaign where the return rate increases the more you use Rakuten services.
- Shopping Marathon: A large-scale campaign held regularly twice a month.
- Spontaneous Campaigns: Campaigns that basically last only one day, increasing the point return rate by a few percent.
Combining these three allows you to shop with around a 20% point return, which is the primary benefit of Rakuten.
Among these, the Shopping Marathon has a mechanism where the points you receive vary depending on the number of stores you purchase from, allowing for a boost of up to 9% in returns.
The concept is to conquer this.
Please check the video I posted on Twitter or access the site yourself to see how it works.
What I Wanted to Solve
- A tool anyone can use without needing manual management
In Rakuten Ichiba, it's hard to plan purchases because you don't know how much more you can buy until you reach the campaign limit.
Because of this, I used to manage how much more I could buy using a spreadsheet.
While some people manage it with Excel, not everyone can do that.
Also, it is a hassle to deal not only with the Shopping Marathon but also with SPU, which has many categories, and spontaneous campaigns that differ every time.
Furthermore, you need to update your management tool every time a campaign changes.
This tool solves that.
- Clarification of point return rates
Recently, the mechanism for the point multiplier system changed, and points are now granted based on the amount after tax.
(Example: 10x return rate on screen -> actually 9.09%)
This makes the actual return rate difficult to understand intuitively.
I felt that I was often placing orders without knowing exactly how much of a deal I was getting.
This tool resolves that.
Points of Focus
- Responsive Support
I created different UIs for mobile and PC: a card-style carousel for mobile and a table format for PC.
Initially, I tried using a table for mobile as well, but I realized it was difficult to manipulate a table on a smartphone, so I felt the need for a dedicated UI.
I wanted to release it in about two weeks, but this caused the workload to roughly double (haha).
- UI that is Fun to Use
Since I thought people wouldn't use it if it just "barely worked," I researched visually appealing designs.
Once I started, I became thoroughly committed and aimed for a UI that is fun to operate.
I also included visually pleasing features like modals for SPU settings and a count-up animation for displaying calculation results.
Please check out the actual movement!
- Enter Key Focus Support for PC Version
To make it feel like Excel, I made it possible to move to the next form field with the Enter key and the previous one with Shift + Enter.
Tech Stack
Next.js, TypeScript, Tailwind CSS, Recoil, Netlify
Since these were all technologies I was touching for the first time, I made my technology selections through trial and error.
-
Next.js, React
I chose them because Pages and API Routes seemed intuitive and easy to use.
Every Vercel library is wonderful, and I'm impressed. -
TypeScript
I understood the value after touching Python and plain JavaScript.
Having types is great...! -
Tailwind CSS
Everyone was using it.
It's similar to Bootstrap in usage and was very easy to work with. -
Recoil
Props drilling made state management impossible, so I introduced it out of necessity.
I will explain this later. -
Netlify
Vercel was so convenient that I wanted to use it, but since there are restrictions on commercial use, I went with Netlify.
Netlify currently doesn't have servers in the Japan region, so the Lighthouse score dropped slightly.
Internal Structure Introduction
src
├── components
│ ├── carousel // Components for mobile
│ │ └── …
│ ├── common // Common components
│ │ └── …
│ ├── layouts // Headers, footers, etc.
│ │ └── …
│ └── table // Components for PC
│ └── …
├── hooks
│ ├── useFocusControl.ts // Hook used for focus movement in PC display
│ └── useItemRow.ts // Hook for row operations
├── pages
│ ├── api
│ │ ├── inquiry.ts // API for sending emails
│ │ └── search.ts // API for fetching advertisements
│ ├── _app.tsx
│ ├── _document.tsx
│ ├── index.tsx // Top page
│ └── inquiry.tsx // Contact page
├── recoil
│ ├── atom.ts
│ └── selector.ts
├── styles
│ └── grobals.css
└── types
└── types.ts
Except for the contact page (inquiry.tsx), it is a simple structure that fits on a single page.
import Head from 'next/head';
import { useEffect } from 'react';
import { useSetRecoilState } from 'recoil';
import { useMediaQuery } from 'react-responsive';
import { isMobileState } from '@/recoil/atom';
import { CarouselFooter, ItemCarousel } from '@/components/carousel';
import { Adsense, CalculateResult, Information, RakutenItems, SpuModal } from '@/components/common';
import { TableHeader, TableBody, TableFooter } from '@/components/table';
export default function Home() {
const setIsMobile = useSetRecoilState(isMobileState);
const isMobile = useMediaQuery({ maxWidth: 1024 });
useEffect(() => {
setIsMobile(isMobile);
}, [isMobile]);
return (
<>
<Head>
<title>Point Sprint: Rakuten Ichiba Shopping Marathon Strategy Calculation Tool</title>
</Head>
<div className="lg:hidden">
<Information />
<div className="bg-blue-100 m-6">
<Adsense />
</div>
<SpuModal />
<ItemCarousel />
<CarouselFooter />
</div>
<div className="max-lg:hidden">
<div className="flex max-w-5xl justify-center items-center mx-auto">
<Information />
<SpuModal />
</div>
<form className="grid justify-center">
<table className='border-spacing-0'>
<TableHeader />
<tbody>
<TableBody />
<TableFooter />
</tbody>
</table>
</form>
</div>
<CalculateResult />
<div className="bg-blue-100 m-6">
<Adsense />
</div>
<div className="flex flex-col justify-center items-center">
<RakutenItems />
</div>
</>
);
}
- Client Side
Dedicated components for mobile and PC displays are conditionally rendered using CSS.
- Server Side
Server-side processing is handled by Next.js API Routes, which receive requests and return responses.
In this app, there are two: search.ts, which makes requests to the Rakuten Ichiba API for advertisements, and inquiry.ts, which sends inquiry details via email.
Code Snippets & Highlights
I would like to introduce some of the parts that were difficult or where I put in extra effort.
Recoil
As I progressed with componentizing the page elements, I found myself passing states from child components to grandchild components, and needing to access state from components that didn't have a parent-child relationship. This made it impossible to manage everything with useState alone. At that point, I started researching state management libraries.
I decided on Recoil because it is relatively new and made by Meta (the creators of React), but above all, because it was extremely simple to use.
Briefly explained:
-
atom
A single state. -
atomFamily
Allows storing multiple atom states of the same type in a key-value format. It can be used instead of an array and avoids re-rendering the entire set. -
selector
Returns or sets a value processed based on the values of atoms or other selectors. -
selectorFamily
A selector that can handle anatomFamilybased on a received key.
By using the useRecoilValue hook, these can be called in the same way as useState.
Initially, I had functions within the components that output calculation results based on values. However, by introducing Recoil, I was able to organize those functions as selectors in a separate file, allowing me to separate display and logic and clarify responsibilities.
useFocusControl.ts
Regarding focus movement on the PC version of the page, I have written about it in detail in another article.
Conclusion
I noticed some strange things while writing this article and corrected quite a few parts.
I decided I should continue to produce output from now on.
Development started on April 12th and was released on May 11th, so the development period was exactly about one month.
Since it was my first time working with this framework, it took quite a while, but I think I can create things in a shorter period next time.
I changed careers to become an IT engineer in April 2022 and worked hard for a year with the goal of entering development, but I wasn't able to get involved in any development projects.
However, as a result of showing this service to sales staff and promoting it during interviews, it has been decided that I can participate in a Java project starting next month...!
I felt once again the importance of showing a portfolio.
This time, I created a service that I personally wanted, hoping it would serve as a portfolio.
If you are going to make something based on this, I think incorporating database connections or OAuth authentication would lead to even more appeal.
Even though my goal of participating in a development project has been decided, I would be sad if nobody used what I put effort into making.
I'll post the link once more, so please give this service a try!
Especially when buying PC parts, Furusato Nozei (hometown tax donation), or Apple Gift Cards for Apple product purchases, it's extremely effective.
Rakuten Ichiba is truly a great deal when you master it, so please use it!
Discussion