ããã«ã¡ã¯ãã·ã¹ãã éçºä¸é¨ã®æ©æ¬ã§ãã
Webã¢ããªã±ã¼ã·ã§ã³éçºã¯æ¥é²ææ©ã®é²åãéãã¦ãããè¿å¹´ã®éçºã®ææ³ã¨ãã¦T3 Stackã話é¡ãæ«ã£ã¦ãã¾ããä»åã¯ãã¡ãã«ã¤ãã¦ãç´¹ä»ãã¦ããããã¨æãã¾ãã
T3 Stackã¯Theoæ°ã«ãã£ã¦æå±ãããæè¡ã¹ã¿ãã¯ã§ããã®æ ¸å¿ã«ããã®ã¯ãsimplicityãããmodularityãããfull-stack typesafetyãã®ä¸ã¤ã®èãæ¹ã§ãã
å ·ä½çã«ã¯ãT3 Stackã¯ä»¥ä¸ã®æè¡ãä¸å¿ã«æ§æããã¦ãã¾ãã
- Next.js
- TypeScript
- tRPC
- Tailwind CSS
- Prisma
- NextAuth.js
ãããã®æè¡ãç¨ãããã¨ã§ãT3 Stackã¯Webéçºã®å¹çã¨å®å ¨æ§ãåä¸ããããã¨ãç®æãã¦ãã¾ãã
T3 Stackã®å 訳
Next.js
Reactããã¼ã¹ã«ããããã³ãã¨ã³ããã¬ã¼ã ã¯ã¼ã¯ã§ãRouterãSSR(Server Side Rendering)ãSSG(Static Site Generation)ãISR(Incremental Static Regeneration)çã¨ãã£ãé«åº¦ãªã¬ã³ããªã³ã°æ¦ç¥ãæä¾ãã¦ãã¾ããã¾ãSPA(Single Page Application)ããMPA(Multi Page Application)ã¾ã§ããã¾ãã¾ãªç¨®é¡ã®Webã¢ããªã±ã¼ã·ã§ã³ãä½æãããã¨ãå¯è½ã§ãã
ããã«ãããåçãªã³ã³ãã³ããæã¤å¤§è¦æ¨¡ãªWebã¢ããªã±ã¼ã·ã§ã³ã§ããæé©ãªã¢ããã¼ããå®è£ ãå®ç¾ãããã¨ãã§ãã¾ãã
TypeScript
éçåä»ãè¨èªã§JavaScriptãããå®å ¨ã«ãããå¹ççã«æ¸ããã¨ãåºæ¥ãä»æ¥ããã³ãã¨ã³ãéçºã«ããã¦ãæãå©ç¨ããã¦ããè¨èªã®ã²ã¨ã¤ã§ãã
åå®å ¨æ§ã¯Webã¢ããªã±ã¼ã·ã§ã³éçºã«ããã¦éè¦ãªè¦ç´ ã§ãããT3 Stackã§ããã®éè¦æ§ã強調ããã¦ãã¾ãã
tRPC
RPC (Remote Procedure Call)ã®ç念ãTypeScriptã®éçåä»ãã¨çµã¿åãããã©ã¤ãã©ãªã§ãã
ããã«ãããã¯ã©ã¤ã¢ã³ãã¨ãµã¼ãã¼éã§åãç´æ¥å ±æãããã¨ãã§ããAPIã®ã¨ã³ããã¤ã³ããå¼ã³åºãããã®ç¹æ®ãªã¯ã©ã¤ã¢ã³ãã³ã¼ããçæãã¾ãããã®ãããããã¯ã¨ã³ãã¨ããã³ãã¨ã³ãéã§ã®APIã®ããã¥ã¡ã³ãã«ããææçéã®åé¡ã解æ¶ããå ¨ä½ã¨ãã¦ã®éçºå¹çãå¤§å¹ ã«åä¸ããã¾ãã
Tailwind CSS
ã¦ã¼ãã£ãªãã£ãã¡ã¼ã¹ãã®CSSãã¬ã¼ã ã¯ã¼ã¯ã§ãã³ã³ãã¼ãã³ããå¹ççã«ã³ã¼ãã£ã³ã°ããããã®CSSã¯ã©ã¹ãæä¾ãã¾ãã
ããã«ããããã¶ã¤ãã¼ãéçºè ã¯HTMLã®ä¸ã«ç´æ¥ã¹ã¿ã¤ã«ãæ¸ããã¨ã§ãè¦è¦çãªå¤æ´ãå³åº§ã«åæ ããããã¨ãã§ãã¾ããã¾ããTailwind CSSã¯å®å ¨ã«ã«ã¹ã¿ãã¤ãºå¯è½ã§ãããã¸ã§ã¯ãã®è¦ä»¶ã«å¿ãã¦ã¹ã¿ã¤ã«ã調æ´ãããã¨ãã§ãã¾ãã
Â
Prisma
Node.jsã¨TypeScriptã使ç¨ããåå®å ¨ãªORMã§ãã
ãã¼ã¿ãã¼ã¹ã®ã¹ãã¼ãå®ç¾©ãè¡ããã¨ã§ãã¢ãã«ãã¼ã¹ã®åã¨é¢æ°ã®èªåè£å®ãæä¾ãã¾ããããã«ãããã¢ããªã±ã¼ã·ã§ã³ã®ã¢ãã«ã¨ãã¼ã¿ãã¼ã¹ã®ã¢ãã«ãä¸è´ããããå®å ¨ã«ã³ã¼ããæ¸ããã¨ãå¯è½ã«ãªãã¾ãã
NextAuth.js
Next.jsã¢ããªã±ã¼ã·ã§ã³ã®ããã®ãµã¼ãã¼ãµã¤ãèªè¨¼ã©ã¤ãã©ãªã§ãã»ãã·ã§ã³ç®¡çãèªè¨¼ãããã¤ãã¼ã®çµ±åãCSRFä¿è·ãªã©ãèªè¨¼ã«é¢é£ããæ©è½ãç¶²ç¾ ãã¦ãã¾ãã
NextAuth.jsã¯JWT(JSON Web Tokens)ãã¼ã¹ã®ã»ãã·ã§ã³ç®¡çããµãã¼ããã¦ãããæ§ã ãªèªè¨¼ãããã¤ãã¼ã¨çµ±åãããã¨ãã§ãã¾ãã
ãããã®æè¡ã®çµã¿åããã«ãããT3 Stackã¯Webã¢ããªã±ã¼ã·ã§ã³éçºãã·ã³ãã«ã«ããã¤ã¢ã¸ã¥ã©ã¼ã§ãããã¦ã¨ã³ããã¼ã¨ã³ãã®åå®å ¨ã確ä¿ãããã®ã«ãã¾ãã
ããã«ãããéçºè ã¯ã¢ããªã±ã¼ã·ã§ã³ã®å質ã確ä¿ããªãããè¿ éãªéçºãµã¤ã¯ã«ãç¶æãããã¨ãå¯è½ã«ãªãã¾ãã
T3 Stackã®ç®æãæ¹åæ§
T3 Stackã¯ãWebéçºã«ãããç¹å®ã®åé¡ã解決ããããã«è¨è¨ããã¦ãã¾ãã
ããããããã¯åã«å
¨ã¦ã®æ©è½ãè©°ãè¾¼ãããã§ã¯ãªããã¹ã¿ãã¯ã«å«ã¾ããåæè¡ã解決ãã¹ãç¹å®ã®åé¡ãæ確ã«ãã¦ãããã¨ãéè¦ã§ãã
ã¾ããT3 Stackã¯ããªã¹ã¯ãç©æ¥µçã«åããã¨ããèãæ¹ãæå±ãã¦ãã¾ãã
ææ°ã®æè¡ã¯ãªã¹ã¯ãä¼´ãã¾ããããªã¹ã¯ã®å°ãªãé¨åã§ç©æ¥µçã«æ°ããªæè¡ãå°å
¥ããæé©ãªãã©ã³ã¹ã追æ±ãã¾ãã
ããã¦ãT3 Stackã«ããã¦æãéè¦ãããã®ããåå®å
¨æ§ãã§ãã
T3 Stackã®ä¸å¿æè¡ã®2ã¤ãTypeScriptã¨tRPCã¯ãåå®å
¨æ§ãå¼·ãæèãã¦è¨è¨ããã¦ãã¾ãã
ããã«ãããT3 Stackã¯åå®å
¨ãªWebã¢ããªã±ã¼ã·ã§ã³éçºãå®ç¾ãã¾ãã
ã¾ã¨ã
T3 Stackã¯ãåå®å ¨æ§ãéè¦ããç°¡æ½ãã¨ã¢ã¸ã¥ã¼ã«æ§ããã©ã³ã¹è¯ãçµã¿åãããæ°ããªWebéçºã®ã¢ããã¼ããæä¾ãã¦ãã¾ãã
ããããã®æè¡ã¯ããèªä½ã§åªããæ©è½ãæã¤ä¸æ¹ã§ãåããã¦ä½¿ç¨ãããã¨ã§å¹æãæ大åãããã¨ãã§ãã¾ãã
ãã®T3 Stackãä½é¨ãã¦ã¿ããã¨ããæ¹ã¯ãcreate-t3-app
ã使ãã¨ç°¡åã«å§ãããã¨ãã§ãã¾ãã®ã§ããã²è©¦ãã¦ã¿ã¦ã¯ãããã§ãããããç¾ä»£ã®Webéçºã«ããã¦ãT3 Stackã¯æ°ããªå¯è½æ§ãåºãããã¨ã§ãããã
Â